Hi Stephen,
I am using EO Pro on a members website where a number of event organisers would like to allow one member to book on behalf of other members in a single booking, but also to know who has booked what (ie not just that Member A has booked 3 tickets, but that Member A has booked tickets for Member B and Member C etc). The bookings are quite often for conference style events, where each member will book a range of tickets for a single event to build up an individual package. Currently a member can book multiples for each ticket, but it isn’t clear who each ticket is booked for. It is also desirable that event emails are sent to all attending members, rather than just the person who made the booking.
You have mentioned in previous posts the ability to have per ticket meta via an API, but I can’t clearly see how to access this, and I’m not sure this would be ideal for the conference style bookings.
With the recent changes to the booking form system, is there a way that eg an extra form could be generated to book tickets for a second/third person before proceeding to the payment form?
Owen Morris
This is possible, through the booking form API you can add “attendee questions”, and to that add a field for entering who the ticket is for.
The details of that depend exactly on your client’s requirements. For instance, how do they want to the user to identify who the ticket is for? It could be a dropdown, a free-input or something a bit more complicated. If its a free-input, can I assign the ticket to an individual who isn’t a member? If so, then the example given here might be sufficient: https://wp-event-organiser.com/blog/tutorial/attendee-questions/ (see attached a subset of the code in that blog post). If not then you would need some form of input to select a user, and then store that user ID.
For the second part, including the members in email notifications is reasonably straightforward provided it suffices to CC or BCC the ticket holder:
add_filter( 'eventorganiser_booking_confirmed_email_headers', function( $headers, $booking_id ) {
//iterate over every ticket
$tickets = eo_get_booking_tickets($booking_id);
if($tickets) {
foreach($tickets as $ticket) {
//extract associated email
$email = eo_get_booking_ticket_meta( $ticket->id(), '_eo_booking_meta_attendee-email', true );
//CC ticket holder
$headers[] = "Cc: $email"
}
}
return $headers;
}, 10, 2 );
In the above (untested) code we assumes you’ve implemented the code in the above link. We extract the emails from the tidckets and CC them in the booking confirmation email.
If instead your client wants to ensure tickets are assigned to known members, then it might be better to store a user ID (instead of name/email), and in that instance we’d need to modify the code slightly to get the email from the user ID.
Stephen Harris