Quick and dirty way to add position descriptions (and have them emailed out)

HomeForumsGeneral Support – NOT for Volunteer and PTA plugins!Quick and dirty way to add position descriptions (and have them emailed out)

Viewing 0 reply threads
  • Author
    Posts
    • #9245
      Mark Leigh
      Participant

      FAIR WARNING: This will render your plugin non-upgradeable; unless you backstream your changes into the new versions.

      This is the quick way; as the plugin doesn’t use WP objects for the shifts. The proper way would be to add the column to the database and modify all the relevant functions; but I didn’t have time for that.

      Step 1: Install the unrelated plugin “CM Tooltip Glossary” and activate
      Step 2: Add position names to the glossary; and descriptions. As soon as this is done anywhere the shift name (eg; “Bartender”) appears on your site, such as in a sign up sheet, it will linked (and be a hover tooltip) to your glossary definition.

      If you don’t need them in e-mails; you’re done. If you do; read on.

      Step 3: In /classes/class-pta_sus_emails.php, find the function send_mail(). Somewhere before the template tags are replaced (line 125 as of plugin version 1.12.4) add the following:

            	// get the description of the position from the glossary so we can e-mail it - yes this is a kludge job
      
      	$thetitle = $task->title;
            	$posdesc_post = get_page_by_title( $thetitle, OBJECT, 'glossary' );
      
      	if($posdesc_post){
        	  $posdesc = $this->convert_to_plain_text($posdesc_post->post_content);
      
      	}
      

      Step 4: In the same class, add another str_replace for the new template tag you’re creating

              $message = str_replace('{position_description}', $posdesc, $message);
      

      Step 5:
      Either buy the PTA vol sus customizer plugin from Stephen, or head over to /classes/class-pta_sus_options.php
      On line 585, 593, and 601 add the new template tag “{position_description}” so that admins know the option is available to them to use.

      
              echo '' . __('Available Template Tags: ', 'pta_volunteer_sus') . '{sheet_title} {sheet_details} {task_title} {date} {start_time} {end_time} {details_text} {item_details} {item_qty} {firstname} {lastname} {contact_emails} {site_name} {site_url} {event_specifics} {position_description}';
      

      Step 6: Use the new tag {position_description} it in your e-mail templates in the Sign-up sheets settings.

      • This topic was modified 8 years, 1 month ago by Mark Leigh.
      • This topic was modified 8 years, 1 month ago by Mark Leigh.
Viewing 0 reply threads
  • You must be logged in to reply to this topic.