Reply To: Multiple details fields for a task

#14228
Carl L
Participant

I made the following code modifications to ask for multiple details in the existing details field. Any site manager should take care making code modifications and know what you are doing. Modifying a live plugin is NOT recommended. I make these suggestions after testing on my site, but they may not work on your site. Backup your code if you make modifications.

The intention of this edit is to provide the sign-up volunteer with a larger textbox for entering the details and also pre-fill the box with a numeral ‘1.’ and numeral ‘2.’ on separate lines. This change permits the prompt (in the second edit below) to ask the volunteer to enter one detail on line ‘1.’ and another detail on line ‘2.’
Modify form pta-volunteer-sign-up-sheets/classes/class-pta_sus_public.php
in the function display_signup_form
near bottom, search for $task->details_text
on the next line
change:

<input type=”text” id=”signup_item” name=”signup_item” value=”‘.((isset($_POST[‘signup_item’])) ? esc_attr($_POST[‘signup_item’]) : ”).'” />

to (the new line after 1. is important):
<textarea id=”signup_item” name=”signup_item”>’.((isset($_POST[‘signup_item’])) ? esc_attr($_POST[‘signup_item’]) : ‘1.
2.’).'</textarea>

The intention of the next edit is to provide a larger box for the form manager to compose the prompt for the box where details are to be entered during signup. By default, this field is pre-filled with “Item you are bringing” but during creation of the sign-up form, the text can be edited to ask the volunteer to enter something on line 1. and something else on line 2.
Modify form pta-volunteer-sign-up-sheets/classes/class-pta_sus_admin.php
in the function display_tasks_form
search for: Details label
(about 80% through file)

On the next line, replace:
echo ‘<span class=”pta_toggle”><br />’.__(‘Details text:’,’pta_volunteer_sus’).’ <input type=”text” class=”details_text” name=”task_details_text[‘.$i.’]” id=”task_details_text[‘.$i.’]” value=”‘.((isset($f[‘task_details_text’][$i]) ? esc_attr($f[‘task_details_text’][$i]) : __(“Item you are bringing”, “pta_volunteer_sus” ) )).'” size=”25″></span>’;

with:
echo ‘<span class=”pta_toggle”><br />’.__(‘Details text:’,’pta_volunteer_sus’).’ <textarea class=”details_text” name=”task_details_text[‘.$i.’]” id=”task_details_text[‘.$i.’]” rows=”2″ cols=”50″>’.((isset($f[‘task_details_text’][$i]) ? esc_attr($f[‘task_details_text’][$i]) : __(“Item you are bringing”, “pta_volunteer_sus” ) )).'</textarea></span>’;

Finally, it would be good if the database field of the volunteer detail response was larger. Currently it is 100 characters and the form returns an error if the volunteer tries to enter more than 100 characters. The limit for the size of the prompt is 200 characters.