Advertisement
eventsmanager

Custom Booking Summary Registered Name

Mar 19th, 2024
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. <?php
  2. /*
  3. * paste in your theme functions.php
  4. * after adding in your functions.php, go to Events > Bookings > Recent Bookings or by clicking an specific
  5. * click on the Gear icon and drag&drop field "Booked Name"
  6. */
  7.  
  8. function my_em_bookings_table_cols_template_booked_name($template, $EM_Bookings_Table){
  9. $template['booked_name'] = 'Booked Name';
  10. return $template;
  11. }
  12. add_action('em_bookings_table_cols_template', 'my_em_bookings_table_cols_template_booked_name',10,2);
  13.  
  14. function my_em_custom_booking_form_cols_booked_name($replace, $col, $EM_Booking, $EM_Bookings_Table, $csv){
  15.  
  16. if( $col == 'booked_name' ){
  17. $name = "";
  18. $first_name = "";
  19. $last_name = "";
  20.  
  21. if( !empty($EM_Booking->booking_meta['registration']['first_name']) ){
  22. $first_name = trim($EM_Booking->booking_meta['registration']['first_name']);
  23. }
  24. if( !empty($EM_Booking->booking_meta['registration']['last_name']) ){
  25. $last_name = trim($EM_Booking->booking_meta['registration']['last_name']);
  26. }
  27.  
  28. $replace = $first_name." ".$last_name;
  29. }
  30. return $replace;
  31. }
  32. add_filter('em_bookings_table_rows_col','my_em_custom_booking_form_cols_booked_name', 10, 5);
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement