We are using the booking option for both free and paid tickets for users that are logged in only.
- In my test I am not seeing the First Name or Last Name stored against the booking in backend, export or the notification that goes to the admin. These fields are populated in the WP users table (the username and emails are pulled in).
- Notification – on booking an email is send to the site admin, but the Bookee is not getting any notification. I am can’t seem to find a way to enable this?
Ian Smith
Update – I have the notification working now. Issue was a mis-configured SMTP.
Ian Smith
Hi Ian,
By default the display name is used by default. This is because the first/last name might not be provided.
The content of the notification email sent to the admin user is applied through the filter eventorganiser_notify_confirmed_booking_message
, so you can replace the tag there:
add_filter('eventorganiser_notify_confirmed_booking_message', function($message){
$message = str_replace('%display_name%', '%first_name% %last_name%', $message);
return $message;
}, 10, 1);
You can also add additional columns to the booking/tickets export:
add_filter('eventorganiser_export_bookings_headers', function($headers){
$headers['bookee_fname'] = 'First name';
$headers['bookee_lname'] = 'Last name';
return $headers;
}, 10, 1);
Stephen Harris
Thank you, that did the trick.
Is it also possible to add the first name / last name to the data displayed in the Admin Booking table under “Bookee” ?
I tried this, but didn’t work:
//Print column cell
add_action( 'eventorganiser_booking_table_column', function( $column_name, $item ){
if ( 'booking_bookee' == $column_name ) {
echo esc_html( eo_get_booking_meta( $item->ID, 'bookee_first_name' ) );
echo ' ';
echo esc_html( eo_get_booking_meta( $item->ID, 'bookee_last_name' ) );
}
}, 10, 2 );
Ian Smith
Re-posting here as I replied via email to Ian.
You can add a column with this code:
<?php
add_filter( 'manage_event_page_bookings_columns', function( $columns ) {
$columns['new_column'] = 'Custom field';
return $columns;
}, 20 );
add_action('eventorganiser_booking_table_column', function($column, $booking){
if ($column === "new_column") {
echo "content..."
}
}, 10, 2);
But you cannot change the content of an existing column. What you would need to do is remove the column you wish to change (unset($columns['column-key-to-remove'])
and then add a new column (with a different key);
You can also re-order columns by re-ordering the associative array in manage_event_page_bookings_columns
Stephen Harris