Created
December 2, 2015 21:55
-
-
Save vaughanm/c3c6fb288975b4708801 to your computer and use it in GitHub Desktop.
Add client Name & Date to Apps+ Cancellation Email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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