eventsmanager

Custom Booking Summary Field - Attendee List

Jul 25th, 2013
1,523
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 "Attendee Name"
  6.  */
  7.  
  8. function my_em_bookings_table_cols_template_attendee2($template, $EM_Bookings_Table){
  9.     $template['attendee_name'] = 'Attendee Name';
  10.     return $template;
  11. }
  12. add_action('em_bookings_table_cols_template', 'my_em_bookings_table_cols_template_attendee2',10,2);
  13.  
  14. function my_em_custom_booking_form_cols_attendee_list($val, $col, $EM_Booking, $EM_Bookings_Table, $csv){
  15.     if( $col == 'attendee_name' ){
  16.         $EM_Tickets_Bookings = $EM_Booking->get_tickets_bookings();
  17.         $attendee_datas = EM_Attendees_Form::get_booking_attendees($EM_Booking);
  18.         $attendee_list = "";
  19.         foreach( $EM_Tickets_Bookings->tickets_bookings as $EM_Ticket_Booking ){
  20.             //Display ticket info
  21.             if( !empty($attendee_datas[$EM_Ticket_Booking->ticket_id]) ){
  22.                 $val .= "Ticket name: ".$EM_Ticket_Booking->get_ticket()->ticket_name."|";
  23.                 foreach( $attendee_datas[$EM_Ticket_Booking->ticket_id] as $attendee_title => $attendee_data ){
  24.                     $val .= $attendee_title."|";
  25.                     foreach( $attendee_data as $field_label => $field_value){
  26.                         $val .=  $field_label .': '.$field_value."|";
  27.                     }
  28.                 }
  29.             }
  30.         }
  31.     }
  32.     return $val;
  33. }
  34. add_filter('em_bookings_table_rows_col','my_em_custom_booking_form_cols_attendee_list', 10, 5);
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×