• Resolved gibknits

    (@gibknits)


    Love your plugin!

    The admin for our employee scheduler site doesn’t want a separate email for employee notes – he wants the notes to be sent when the employee has clocked out. Therefore, I modified the function wpaesm_clock_out_notification to include the following:

    $employeenotes = get_post_meta($shift_id, '_wpaesm_employeenote', true);
    		$message .= "<p><strong>" . __( 'Notes:', 'wpaesm' ) . "</strong></p>";
    		foreach( $employeenotes as $note ) {
    			if( isset( $note['notedate'] ) && isset( $note['notetext'] ) ) {
    				$message .= "<p><strong>" . $note['notedate'] . ":</strong> " . $note['notetext'] . "</p>";
    			}
    		}

    [Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]

    This is great, until there is an update to the plug-in. Then my modification is hosed. ?? Can we either disable the auto-update of the plugin, or have the option of notes being included with the clock-out email?

    Thanks for your time.

    • This topic was modified 7 years, 11 months ago by bdbrown.
Viewing 1 replies (of 1 total)
  • Plugin Author Morgan Kay

    (@gwendydd)

    Good question!

    You are right that your modification will be lost when you update the plugin. However, not updating the plugin would be a really bad idea, because then you would miss out on new features and if any new updates patch security vulnerabilities, you would still be vulnerable.

    Speaking of which, I am planning to release version 2.0 this week, which is a major code overhaul – the plugin has been completely rewritten from the ground up. So when 2.0 comes out, you can customize this once and for all.

    Do you know about action hooks? If not, here’s a good intro: https://www.nathanrice.net/blog/an-introduction-to-wordpress-action-hooks/ Employee Scheduler has several action hooks built in which let you modify how it works. There is an action hook for clocking out. In 2.0, you can do this to use that action hook:

    add_action( 'shiftee_clock_out_action', 'send_note_when_clocked_out', 10, 2 );
    function send_note_when_clocked_out( $shift ) {
      /* here you would write some code that checks whether the shift has a note, and if so, email the note */
    }

    Let me know if you have any questions about this!

Viewing 1 replies (of 1 total)
  • The topic ‘function wpaesm_clock_out_notification modification’ is closed to new replies.