Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * This function will send email to each individual attendee using Attendee Form
- *
- * - add form field with the following in your Forms Editor > Attendee Form
- * - Field Label => Email
- * - Field ID => attendee_email
- *
- * How to use this snippet
- * - using your host cpanel or ftp, go to wp-content > (create this folder) mu-plugins > (create this php file) functions.php
- * - edit file functions.php
- * - paste the snippet below
- *
- * Booking Status:
- * 0 = Pending
- * 1 = Approved
- * 2 = Rejected
- * 3 = Cancelled
- * 4 = Awaiting Online Payment
- * 5 = Awaiting Payment
- */
- function my_em_custom_email($result, $EM_Booking){
- if ( $EM_Booking->booking_status == 1 ){
- $emails = array();
- $attendees = $EM_Booking->booking_meta['attendees'];
- if ( !empty($attendees) ){
- foreach($attendees as $key => $value) {
- if( is_array($value) ){
- foreach($value as $key2 => $value2) {
- array_push($emails,$value2["attendee_email"]);
- }
- }
- }
- foreach($emails as $key => $value) {
- $EM_Booking->email_send(
- $EM_Booking->output(get_option('dbem_bookings_email_confirmed_subject')).' - [TEST-ATTENDEE FORM EMAIL]',
- $EM_Booking->output(get_option('dbem_bookings_email_confirmed_body')),
- $value
- );
- }
- }//END - if ( !empty($attendees) )
- }
- return $result;
- }
- add_filter('em_booking_set_status','my_em_custom_email',100,2);
Advertisement
Comments
-
- i added this, but where do i use it in wordpress?
Add Comment
Please, Sign In to add comment
Advertisement