Skip to content

Instantly share code, notes, and snippets.

@vaughanm
Created December 2, 2015 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vaughanm/c3c6fb288975b4708801 to your computer and use it in GitHub Desktop.
Save vaughanm/c3c6fb288975b4708801 to your computer and use it in GitHub Desktop.
Add client Name & Date to Apps+ Cancellation Email
function my_app_email_on_appointment_cancelled ($app_id) {
global $appointments;
$to = $appointments->get_admin_email();
$appt = $appointments->get_app($app_id);
$date = date_i18n( 'F j, Y', strtotime( $appt->start ) ) . ' at ' . date_i18n( 'G:i', strtotime( $appt->start ) );
$body = "{$appt->name} cancelled his appointment on {$date}\n\n
Appointment ID {$app_id}";
$worker_email = $appointments->get_worker_email($appt->worker);
if(is_array($to)) {
$to[] = $worker_email;
} else {
$to = array($to, $worker_email);
}
wp_mail($to, 'An appointment has been cancelled', $body);
}
add_action('app-appointments-appointment_cancelled', 'my_app_email_on_appointment_cancelled');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment