Advertisement
eventsmanager

send email to each individual attendee using Attendee Form

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