Notification Emails

Booking notification e-mails are sent when a booking is made/confirmed, (as per the settings in Settings > Event Organiser > Bookings)

notification-settings

The settings allow you to select whether you are notified if a booking is made or confirmed.

By default they are sent to the site admin’s email, which is set in Settings > General “email address” option.

Changing booking notification content

The content and subject of booking notifications sent to the site admin can changed with using the following four filters:

  • eventorganiser_notify_confirmed_booking_message
  • eventorganiser_notify_confirmed_booking_subject
  • eventorganiser_notify_new_booking_message
  • eventorganiser_notify_new_booking_subject

These filters allow you to change the content (or subject) template for the respective emails. This template can include placeholders. E.g. the default e-mail notification sent when a booking is confirmed is the following:

 <hr>
 <h2> Booking Confirmed </h2>
 <p> A new booking has been confirmed on your site %site_name%: </p>

 <h3> Booking #%booking_reference% for %event_title% %event_date% </h3>

 %tickets%

 <h3> Bookee </h3>
 <p><strong> Name: </strong> %display_name% </p>
 <p><strong> Email:</strong> %email% </p>

 <h3>Booking form</h3>
 %form_submission%

 <p> You can view the <a href="%booking_admin_url%">booking here</a> </p>

The full list of supported placeholders can be found here.

You can set a different content template using the above filters. For example, to change the notification e-mail sent when a booking is confirmed:

add_filter( 'eventorganiser_notify_confirmed_booking_message', 'set_confirmed_booking_notification_email' );
function set_confirmed_booking_notification_email( $content ){
     return "Booking confirmed for %event_title%. View the booking <a href="%booking_admin_url%">here</a>";
}

You can also use placeholders for the subject.

Changing the booking notification email

By default, there are no UI options to alter the notification email if you want this to be different from the site admin’s email. However, you can download and install this free extension which adds some options under Settings > General > Bookings for you.

Otherwise, you can follow the instructions below.

The site’s admin email, as used by Event Organiser, is filtered with the eventorganiser_admin_email hook.

If you want to change the email address that Event Organiser uses as the site admin e-mail you can use the following code:

function my_event_admin_email( $email ){
      //Change $email;
      return $email;        
}
add_filter( 'eventorganiser_admin_email', 'my_event_admin_email' );

Currently the admin email is only used for booking notifications, but it may in the future be used for other purposes. So if you only want to change the email for booking notifications, or if you want to set the notification email differently for each booking or event, you can use the following code.

function my_booking_notification_email( $emails, $booking_id ){
      //Change $email. Note this is an array of emails!
      return $emails;        
}
add_filter( 'eventorganiser_booking_notification_email', 'my_booking_notification_email', 10, 2 );

Important: $emails is an array of emails (by default containing just the one email – the site admin), as opposed to a string filtered by eventorganiser_admin_email. This allows you to send booking notifications to multiple email addresses.

As an example, this snippet sends booking notifications to the event organiser and site admin

function my_booking_notification_email( $emails, $booking_id ){

      //Get the event ID and organiser ID
      $event_id = eo_get_booking_meta( $booking_id, 'event_id' );

      //Get the event's organiser
      $organiser_id = get_post_field( 'post_author', $event_id );
      $user_obj = get_userdata( $organiser_id );

      //If the user exists, add their email to notify both organiser and admin
      if( $user_obj ){
          $emails[] = $user_obj->user_email;
      }

      return $emails;        
}
add_filter( 'eventorganiser_booking_notification_email', 'my_booking_notification_email', 10, 2 );