Advertisement
eventsmanager

send email to each individual attendee using Attendee Form

Oct 8th, 2014 (edited)
3,003
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. /*
  2. * This function will send email to each individual attendee using Attendee Form
  3. *
  4. * - add form field with the following in your Forms Editor > Attendee Form
  5. * - Field Label => Email
  6. * - Field ID => attendee_email
  7. *
  8. * How to use this snippet
  9. * - using your host cpanel or ftp, go to wp-content > (create this folder) mu-plugins > (create this php file) functions.php
  10. * - edit file functions.php
  11. * - paste the snippet below
  12. *
  13. * Booking Status:
  14. * 0 = Pending
  15. * 1 = Approved
  16. * 2 = Rejected
  17. * 3 = Cancelled
  18. * 4 = Awaiting Online Payment
  19. * 5 = Awaiting Payment
  20. */
  21.  
  22. function my_em_custom_email($result, $EM_Booking){
  23. if ( $EM_Booking->booking_status == 1 ){
  24. $emails = array();
  25. $attendees = $EM_Booking->booking_meta['attendees'];
  26. if ( !empty($attendees) ){
  27. foreach($attendees as $key => $value) {
  28. if( is_array($value) ){
  29. foreach($value as $key2 => $value2) {
  30. array_push($emails,$value2["attendee_email"]);
  31. }
  32. }
  33. }
  34. foreach($emails as $key => $value) {
  35. $EM_Booking->email_send(
  36. $EM_Booking->output(get_option('dbem_bookings_email_confirmed_subject')).' - [TEST-ATTENDEE FORM EMAIL]',
  37. $EM_Booking->output(get_option('dbem_bookings_email_confirmed_body')),
  38. $value
  39. );
  40. }
  41. }//END - if ( !empty($attendees) )
  42.  
  43. }
  44. return $result;
  45. }
  46. add_filter('em_booking_set_status','my_em_custom_email',100,2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement