Hi Stephen,
In our case a coach is submitting a attendee to a event. The attendee is receiving a confirmation email and
the admin emailaddres. I recieved a question if it was possible to send a copy of the confirmation
email to the coach. I browsed the forum and found this topic:
http://wp-event-organiser.com/forums/topic/remaining-tickets-and-additional-email/
For my understanding: If a create a extra e-mail field in the booking form like (E-mailaddress coach) the
code below will send also the confirmation e-mail to “e-mailaddress coach”?
Or do I have to tell the script that I added a extra e-mailaddress field so it will send also the confirmation e-mail
to the coach?
add_filter( ‘eventorganiser_notify_confirmed_booking’, ‘my_notification_handler’, 10, 2 );
function my_notification_handler( $notify, $booking_id ){
//Do notification e-mails…
//Set $notify to false to disable default behaviour
return $notify;
}
This script is placed also in Your Site’s Functionality Plugin?
Thanks a lot!

Alex Hofstra
Hi Alex,
Just to confirm, you want the booking confirmation to go both to the attendee and the coach? The filter you refer to could be used, but this is simply triggered immediately prior to the e-mail being sent and allows you to either abort the e-mail, or do some other action. That could include sending an e-mail to someone else (e.g. the coach).
There is a better way, however. You can use the e-mail headers CC the coach in. Here I assume that the form field you are using to collect the e-mail has an ID of 123.
add_filter( 'eventorganiser_booking_confirmed_email_headers', function( $headers, $booking_id ) {
$coach_email = eo_get_booking_meta( $booking_id, 'meta_123', true );
$headers[] = "Cc: {$coach_email}";
return $headers;
}, 10, 2 );

Stephen Harris
Hi Stephen,
You assumed right, I want the confirmation in cc to be sent to the coach. Is there a way to tweak the
id of the field? I have 5 different forms and the field id’s are not the same. In fact id: 9, id: 8, id: 11 and some more.
Can I list the all in the script? Or repeat the script for all id’s? Is that a way to go?
Thanks for your quick response earlier, much appreciated 🙂
Alex

Alex Hofstra
The best way is to no use the form customiser, but the API where you can specify an ID for the field (and thus have it the same across all forms – it only needs to be unique within the form).
Here’s a tutorial on how to do that, which incidentally seems to be almost exactly what you’re after: http://wp-event-organiser.com/blog/tutorial/using-form-api-add-additional-fields/

Stephen Harris
Hi Stephan,
Got it! That’s the way to go 🙂 just export the form and and create/import new forms with that template and change where needed.
Thanks!

Alex Hofstra