Advertisement
eventsmanager

#_ATTENDEESLIST template with Ticket Name

May 9th, 2023 (edited)
735
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.78 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  * This snippet will override the template when using placeholder #_ATTENDEESLIST with the ticket name
  5.  *
  6.  * How to install:
  7.  * 1. create these folders within your theme directory
  8.  *    wp-contents > plugin-templates > events-manager > placeholders
  9.  * 2. create attendeeslist.php inside the placeholder folder at step#1 then edit
  10.  * 3. paste this whole snippet
  11.  *
  12.  *
  13.  */
  14.  
  15. $people = array();
  16. $EM_Bookings = $EM_Event->get_bookings();
  17. if( count($EM_Bookings->bookings) > 0 ){
  18.     ?>
  19.  
  20.     <ul class="event-attendees">
  21.     <?php
  22.     foreach( $EM_Bookings as $EM_Booking){ /* @var $EM_Booking EM_Booking */
  23.         if($EM_Booking->booking_status == 1 && !in_array($EM_Booking->get_person()->ID, $people) ){
  24.             $people[] = $EM_Booking->get_person()->ID;
  25.             echo '<li>'. $EM_Booking->get_person()->get_name() .'</li>';
  26.             $EM_Tickets_Bookings = $EM_Booking->get_tickets_bookings();
  27.             $attendee_datas = EM_Attendees_Form::get_booking_attendees($EM_Booking);
  28.             echo '<ul>';
  29.             foreach( $EM_Tickets_Bookings->tickets_bookings as $EM_Ticket_Booking ){
  30.                 if( !empty($attendee_datas[$EM_Ticket_Booking->ticket_id]) ){
  31.                     echo '<li>'.$EM_Ticket_Booking->get_ticket()->ticket_name.'</li>';
  32.                 }
  33.             }
  34.             echo '</ul>';
  35.         }elseif($EM_Booking->booking_status == 1 && $EM_Booking->is_no_user() ){
  36.             echo '<li>'. $EM_Booking->get_person()->get_name() .'</li>';
  37.             $EM_Tickets_Bookings = $EM_Booking->get_tickets_bookings();
  38.             $attendee_datas = EM_Attendees_Form::get_booking_attendees($EM_Booking);
  39.             echo '<ul>';
  40.             foreach( $EM_Tickets_Bookings->tickets_bookings as $EM_Ticket_Booking ){
  41.                 if( !empty($attendee_datas[$EM_Ticket_Booking->ticket_id]) ){
  42.                     echo '<li>'.$EM_Ticket_Booking->get_ticket()->ticket_name.'</li>';
  43.                 }
  44.             }
  45.             echo '</ul>';          
  46.         }
  47.     }
  48.  
  49.     ?>
  50.  
  51.     </ul>
  52.  
  53.     <?php
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement