Last active
August 29, 2015 14:15
-
-
Save JudeRosario/2587249950e147f83c5f to your computer and use it in GitHub Desktop.
Appointements + Service Provider Phone in emails
This file contains hidden or 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
// Append the Phone Number to the Confirmation / Reminder mails | |
add_filter( 'app_confirmation_message', 'append_phone_to_app_email', 10, 3 ); | |
add_filter( 'app_reminder_message', 'append_phone_to_app_email', 10, 3 ); | |
function append_phone_to_app_email( $msg, $obj, $app_id) { | |
$worker = $obj->worker; | |
// Get Worker Phone from $meta table | |
$worker_phone = get_user_meta($worker, "app_phone", true); | |
if ( $worker_phone ) { | |
// Search and replace the WORKER_CONTACT string | |
$msg = str_replace( 'WORKER_CONTACT', 'Phone: ' . $worker_phone, $msg ); | |
} | |
return $msg; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simply copy/paste this code snippet into the
functions.php
of a child theme or a site specific code plugin if you use one. Then use the placeholderWORKER_CONTACT
in your email messages, it will be replaced with the Service Provider Phone number