Last active
August 29, 2015 14:14
-
-
Save JudeRosario/c9aed9b455682960353f to your computer and use it in GitHub Desktop.
Locations addon A+
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
// Process Confirmation and Reminders | |
add_filter( 'app_confirmation_message', 'append_location_to_app_email', 10, 3 ); | |
add_filter( 'app_reminder_message', 'append_location_to_app_email', 10, 3 ); | |
function append_location_to_app_email( $msg, $r, $app_id) { | |
// Get Worker Address from BuddyPress | |
$worker_location = xprofile_get_field_data( 'address', $r->worker ); | |
if ( $worker_location ) { | |
$msg = str_replace( 'LOCATION', 'Location: ' . $worker_location, $msg ); | |
} | |
return $msg; | |
} |
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
// Process Confirmation and Reminders | |
add_filter( 'app_confirmation_message', 'append_location_to_app_email', 10, 3 ); | |
add_filter( 'app_reminder_message', 'append_location_to_app_email', 10, 3 ); | |
function append_location_to_app_email( $msg, $obj, $app_id) { | |
// Get Worker Address from Appointment Object | |
$worker = $obj->worker; | |
$worker_location = get_option('app-worker_location-'.$worker , false); | |
$m = new App_Locations_Model() ; | |
// If Location is available then append it to the message | |
$location_data = $m->find_by($worker_location) ; | |
if ( $location_data ) { | |
$msg = str_replace( 'LOCATION', 'Location: ' . $location_data, $msg ); | |
} | |
return $msg; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment