Can booking notification emails go to various addresses depending on event
WordPress Event Management, Calendars & Registration › Forums › Pre Sales Questions › Can booking notification emails go to various addresses depending on event
This topic contains 8 replies, has 3 voices, and was last updated by  Christian Willis 5 years, 7 months ago.
- 
		AuthorPosts
- 
		
			
				
we manage a training calendar that advertises courses by different trainers in various locations. is it possible to have booking “notification” emails sent to trainers email addresses when users book their courses from our calendar. So, Trainer A gets an email to inform them when people are booking their course(s) ? 
 Or do all bookings get email notifications to the same address (by default WP admin) ?Ian Clarke Ian Clarke Hi Ian, Yes, it is with a bit of custom code: function my_booking_notification_email( $emails, $booking_id ){ $event_id = eo_get_booking_meta( $booking_id, 'event_id'); $notification_email = get_post_meta($event_id, 'notification_email'); if ($email) { $emails[] = $notification_email; } return $emails; } add_filter( 'eventorganiser_booking_notification_email', 'my_booking_notification_email', 10, 2 );This code looks for a custom field on the event named notification_emailand adds it the list of emails to be notified (by default it would be just the site admin).You could replace $emails[] = $notification_email;with$emails = [$notification_email]to just notify that email (and not the site admin).And you could also replace $notification_email = get_post_meta($event_id, 'notification_email');with some other way of getting an email (e.g. getting it from the email attached to the event organiser). Stephen Harris Hi, I have followed the instructions and created this as a plugin as per your “Where should I put code from the tutorials?” but an email never gets sent to the notification_email address. Any ideas if I need to do anything else? Christian Willis Hi Christian, I’d recommend putting in some error logging first to ensure your code is being executed. Or failing that, calling exitto halt the script which should end up in a white page (so don’t use that in production).Assuming it isn’t executed, make sure the plug-in (I’m assuming a simple phpfile here) you’ve created is in the root ofwp-content/mu-plugins– i.e. so not a subfolder ofmu-plugins.Stephen Harris Hi Christian, I’d recommend putting in some error logging first to ensure your code is being executed. Or failing that, calling exitto halt the script which should end up in a white page (so don’t use that in production).Assuming it isn’t executed, make sure the plug-in (I’m assuming a simple phpfile here) you’ve created is in the root ofwp-content/mu-plugins– i.e. so not a subfolder ofmu-plugins.Stephen Harris Thanks Stephen, I created the mu-plugins folder and moved the php file but still doesnt work. To be honest I am not skilled in this. Would you be willing to assist for a donation? Christian Willis Hi Christian, I’ll be in touch via email to see if I can help. Stephen Harris Hi Stephen, were you able to take a look at this? Christian Willis 
- 
		AuthorPosts