I created a field for custom email receipts for all events with the Advanced Custom Fields plugin. When someone registers for an event I want the “thank you” message to be what’s in that field on that specific event. How would I pull that in using the eventorganiser_pro_get_option_booking_complete_message_{gateway}
filter and still have %tags% work correctly?

Brian Reeves
It should be the case that get_the_ID()
will return the ID of the event – this assumes you don’t have dedicated ‘thank you’ page, but instead return the user to the booking page. With the ID of the event you can use ACF’s api to get the stored values.
That is fairly low-level hook. I’d recommend using this one instead: eventorganiser_booking_form_form_display_notices
(see http://wp-event-organiser.com/blog/announcements/event-organiser-pro-1-11-0-rc1/ and https://wordpress.org/support/topic/change-notification-text-in-form?replies=3).

Stephen Harris
I’m sorry, by “thank you” message I meant the email that gets sent when a booking is purchased, not the thank you page. I’m wanting the content of the email that gets sent to be an ACF field on that specific event, replacing the default email.

Brian Reeves
I was able to get it working after I found the eventorganiser_booking_confirmed_email_body
filter.
add_filter('eventorganiser_booking_confirmed_email_body', 'my_booking_confirmed_email', 10, 2);
function my_booking_confirmed_email($message, $booking_id)
{
$event_id = eo_get_booking_meta($booking_id, 'event_id');
$email_message = get_field('email_to_registrant', $event_id);
// Only overwrite default email if it's not empty
if (!empty($email_message)) {
$message = $email_message;
}
$message = eventorganiser_email_template_tags($message, $booking_id);
$message = wpautop($message);
return $message;
}
$message = eventorganiser_email_template_tags($message, $booking_id);
$message = wpautop($message);
return $message;
}

Brian Reeves
Sorry Michael, I misunderstood the question.
Glad you’ve go it sorted.
You could also register your own placeholder tags. This means you can still using the confirmation e-mail setting..
Details on registering your own custom placeholder can be found here: http://wp-event-organiser.com/blog/tutorial/including-custom-fields-confirmation-e-mail/
As noted in the example the passed $context
variable will contain the event ID, from which you can retrieve the ACF field value.

Stephen Harris