Skip to content

Instantly share code, notes, and snippets.

@JudeRosario
Last active August 29, 2015 14:14
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 JudeRosario/c9aed9b455682960353f to your computer and use it in GitHub Desktop.
Save JudeRosario/c9aed9b455682960353f to your computer and use it in GitHub Desktop.
Locations addon A+
// 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;
}
// 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