I’m very interested in adding an additional email to receive a notification when an event is booked; however, the documentation does not state where I need to add/modify this code. Can you please point me in the right direction of where to modify the code?
Regards,
JB

JB Woodruff
Are you referring to this post? The referenced code should (ideally) go in a seperate plug-in, but it will also work in your theme’s functions.php. (There’s more details on this here: wp-event-organiser.com/blog/tutorial/where-should-i-put-code-from-the-tutorials/)

Stephen Harris
That is the post/feature that I’m referring to. Given that code, is it possible to enter a specific email address vs. having it use the post author’s email address? I’m assuming I need to enter it in this piece of code in the $emails line; however, I don’t know the correct syntax to add a specific email address. Can you please help? example would be test@123.com that I want to add.
//If the user exists, add their email to notify both organiser and admin
if( $user_obj ){
$emails[] = $user_obj->user_email;
}
return $emails;

JB Woodruff
I believe that this should work:
add_filter( 'eventorganiser_booking_notification_email', 'my_booking_notification_email', 10, 2 );
function my_booking_notification_email( $emails, $booking_id ){
//Add extra email address to array
$emails[] = 'test@123.com';
return $emails;
}
-
This reply was modified 11 years, 1 month ago by
Stephen Harris.

Dario
Thank you again for your help with this.
I added this to the functions.php in my theme; however, it made my site go blank. Figured I’d need to add a ?> to the end, but that didn’t seem to fix things. Any thoughts?
Regards,
JB

JB Woodruff
Your functions.php file should start with <?php
and end with ?>
with the above code in the middle.
Or you could put it into your own custom utility plugin (which is the recommended way anyway) — see this tutorial.
I’m pretty sure that the modified code should work, but I haven’t tested it, will test later in the week when I have some free time if this issue hasn’t been resolved.

Dario
Both my original post, and Dario’s were missing a comma in between 'eventorganiser_booking_notification_email'
and “’my_booking_notification_email’` (now corrected). The code snippets should work ok now.

Stephen Harris
Works like a charm. Thank you very much for your help with this one.

JB Woodruff