<?php
/*
* paste in your theme functions.php
* after adding in your functions.php, go to Events > Bookings > Recent Bookings or by clicking an specific
* click on the Gear icon and drag&drop field "Booked Name"
*/
function my_em_bookings_table_cols_template_booked_name($template, $EM_Bookings_Table){
$template['booked_name'] = 'Booked Name';
return $template;
}
add_action('em_bookings_table_cols_template', 'my_em_bookings_table_cols_template_booked_name',10,2);
function my_em_custom_booking_form_cols_booked_name($replace, $col, $EM_Booking, $EM_Bookings_Table, $csv){
if( $col == 'booked_name' ){
$name = "";
$first_name = "";
$last_name = "";
if( !empty($EM_Booking->booking_meta['registration']['first_name']) ){
$first_name = trim($EM_Booking->booking_meta['registration']['first_name']);
}
if( !empty($EM_Booking->booking_meta['registration']['last_name']) ){
$last_name = trim($EM_Booking->booking_meta['registration']['last_name']);
}
$replace = $first_name." ".$last_name;
}
return $replace;
}
add_filter('em_bookings_table_rows_col','my_em_custom_booking_form_cols_booked_name', 10, 5);
Comments