Last active
June 13, 2019 15:37
-
-
Save joshfeck/eabf84927aed9329665995a21604778c to your computer and use it in GitHub Desktop.
Event Espresso 3, send payment confirmation email to the admin too. Add this function to the site's /wp-content/uploads/espresso/custom_functions.php file
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
<?php | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
if (!function_exists('event_espresso_send_payment_notification')) { | |
function event_espresso_send_payment_notification($atts) { | |
do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); | |
global $wpdb, $org_options; | |
//Extract the attendee_id and registration_id | |
extract($atts); | |
$registration_id = is_array( $registration_id ) ? $registration_id[0] : $registration_id; | |
if ( empty( $registration_id ) && isset( $attendee_id )) { | |
$registration_id = espresso_registration_id($attendee_id); | |
} | |
if ( empty( $registration_id )) { | |
return __('No Registration ID was supplied', 'event_espresso'); | |
} | |
//Get the attendee id or registration_id and create the sql statement | |
$SQL = "SELECT a.* FROM " . EVENTS_ATTENDEE_TABLE . " a "; | |
$SQL .= " WHERE a.registration_id = %s "; | |
$attendees = $wpdb->get_results( $wpdb->prepare( $SQL, $registration_id )); | |
if ($org_options['default_mail'] == 'Y') { | |
foreach ($attendees as $attendee) { | |
event_espresso_email_confirmations(array('attendee_id' => $attendee->id, 'send_admin_email' => 'true', 'send_attendee_email' => 'true', 'custom_data' => array('email_type' => 'payment', 'payment_subject' => $org_options['payment_subject'], 'payment_message' => $org_options['payment_message']))); | |
} | |
} | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment