Created
December 24, 2015 18:38
-
-
Save joshfeck/f42429f93f12d38e933e to your computer and use it in GitHub Desktop.
refactor of Event Espresso 3's event_espresso_send_invoice() function so that each attendee gets a their own unique email reminder. Assumes usage of Multi Event Registration.
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_invoice')) { | |
function event_espresso_send_invoice( $registration_id, $invoice_subject, $invoice_message, $array_of_reg_ids = FALSE ) { | |
global $wpdb, $org_options; | |
do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); | |
$SQL ='SELECT a.attendee_session FROM '. EVENTS_ATTENDEE_TABLE . ' a WHERE a.registration_id = %s'; | |
$result = $wpdb->get_var( $wpdb->prepare( $SQL, $registration_id )); | |
$sql2 = 'SELECT a.id FROM ' . EVENTS_ATTENDEE_TABLE . ' a WHERE a.attendee_session = %s'; | |
$attendee_ids = $wpdb->get_col( $wpdb->prepare($sql2, $result )); | |
foreach ( $attendee_ids as $attendee_id ) { | |
email_by_attendee_id($attendee_id, $send_attendee_email = TRUE, $send_admin_email = false, $multi_reg = FALSE, $custom_data = array('email_type' => 'invoice', 'invoice_subject' => $invoice_subject, 'invoice_message' => $invoice_message)); | |
} | |
return; | |
} | |
}//End event_espresso_send_invoice() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment