Hello,
I want to add the category name of a date to the mail which is sent to the admin if somebody makes a booking at this date.
Regards
Michael

Mikesh
Hi Michael,
Currently the e-mails to the admin are pre-set with no UI to change this. However, you can over-ride the e-mail process after a booking is complete. The disadvantage is that you are over-riding the sending of the admin and bookee e-mail, so you will need to implement this yourself.
add_filter( 'eventorganiser_notify_confirmed_booking', 'my_confirmed_booking_email', 10, 2 );
function my_confirmed_booking_email( $boolean, $booking_id ){
//Send e-mail to bookee and admin
return false; //Return FALSE to prevent default behaviour
}
This isn’t as bad as its sounds as you can effectively replicate the function eventorganiser_notify_confirmed_booking()
. (being careful to remove the lines:
//Allow plugins to over-ride the behaviour of this function
if( !apply_filters( 'eventorganiser_notify_confirmed_booking', true, $booking_id ) ){
return;
}
and so avoiding creating a infinite loop!). To get the booked event’s categories:
$event_id = (int) eo_get_booking_meta( $booking_id, 'event_id' );
$categories = get_the_terms( $event_id );
$categories
is then an array (indexed by term ID) of category objects. Each object in this array has the property name
containing the categorie’s name. See the WordPress codex for more details.
Having an option to alter the admin e-mail (as you can with the booking confirmation e-mail) is on the road map.

Stephen Harris
Hey Stephan,
thank you for your quick reply.
I have to override this function: eventorganiser_notify_new_booking
But if I implement this code in my plugin nothing changed:
add_filter( 'eventorganiser_notify_new_booking', 'my_notify_new_booking', 99, 2 );
function my_notify_new_booking( $boolean, $booking_id ) { MY NEW CODE }
Do you have an idea, what I did wrong?
Regards
Michael

Mikesh
Hi Mikesh,
Where did you put that code snippet? And does your code return false;
at the end to disable the default behaviour?

Stephen Harris
I created a new plugin called my-event-organiser. But every changes I made, didn’t appear in the Booking Mail.

Mikesh
<?php
/*
Plugin Name: My Event Organiser
Description: Adds Category Support for Event Organiser
Version: 1.0
License: GPL
Author: Mikesh
Author URI: www.XYZ.de
*/
add_filter( 'eventorganiser_notify_new_booking', 'my_notify_new_booking', 99, 2 );
function my_notify_new_booking( $boolean, $booking_id ) {
.......
return false; //Return FALSE to prevent default behaviour
}

Mikesh
Hi Michael,
I’m just about to send you an e-mail, because I think it’ll be easier if I can take a look at the plug-in you’ve written.

Stephen Harris