Created
October 24, 2013 18:50
-
-
Save sidharrell/7142876 to your computer and use it in GitHub Desktop.
email admin 1 email for each attendee
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
| function email_by_session_id_custom ($session_id, $send_attendee_email = TRUE, $send_admin_email = TRUE, $multi_reg = FALSE) { | |
| global $wpdb; | |
| $sql = "SELECT id FROM " . EVENTS_ATTENDEE_TABLE . " WHERE attendee_session = %s"; | |
| $attendees = $wpdb->get_col( $wpdb->prepare( $sql, $session_id )); | |
| $admin_email_params = array('email_body'=>''); | |
| foreach ($attendees as $attendee_id) { | |
| $data = espresso_prepare_email_data($attendee_id, $multi_reg); | |
| if ($send_attendee_email == 'true') { | |
| $attendee_email_params = espresso_prepare_email($data); | |
| event_espresso_send_email($attendee_email_params); | |
| } | |
| if ($send_admin_email == 'true') { | |
| $email_params = espresso_prepare_admin_email($data); | |
| event_espresso_send_email($email_params); | |
| } | |
| } | |
| }//End email_by_session_id() | |
| function event_espresso_email_confirmations($atts) { | |
| extract($atts); | |
| //print_r($atts); | |
| $multi_reg = empty( $multi_reg ) ? FALSE : $multi_reg; | |
| $send_admin_email = empty( $send_admin_email ) ? FALSE : $send_admin_email; | |
| $send_attendee_email = empty( $send_attendee_email ) ? FALSE : $send_attendee_email; | |
| $custom_data = empty( $custom_data ) ? '' : $custom_data; | |
| if ( ! empty( $attendee_id ) && ! $multi_reg ) { | |
| email_by_attendee_id($attendee_id, $send_attendee_email, $send_admin_email, $multi_reg, $custom_data); | |
| } elseif ( ! empty( $registration_id ) && ! $multi_reg ) { | |
| global $wpdb; | |
| $sql = "SELECT id FROM " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id = %s"; | |
| $attendees = $wpdb->get_col( $wpdb->prepare( $sql, $registration_id )); | |
| foreach ($attendees as $attendee_id) { | |
| email_by_attendee_id($attendee_id, $send_attendee_email, $send_admin_email, $multi_reg, $custom_data); | |
| } | |
| } elseif ( ! empty( $session_id )) { | |
| email_by_session_id_custom($session_id, $send_attendee_email, $send_admin_email, $multi_reg); | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment