Advertisement
eventsmanager

#_ATTENDEESLIST with booking spaces

Jun 5th, 2018
1,497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  * This snippet will override template when using placeholder #_ATTENDEESLIST and will add attendee names captured by attendee form
  5.  * This assumes that you are using a field with ID attendee_name in your attendee form.
  6.  *
  7.  * How to install:
  8.  * 1. create these folders within your theme directory
  9.  *    wp-contents > themes > Your Theme > (create these folders) plugins > events-manager > placeholders
  10.  * 2. create attendeeslist.php inside placeholder folder at step#1 then edit
  11.  * 3. paste this whole snippet
  12.  */
  13.  
  14. /* @var $EM_Event EM_Event */
  15. $people = array();
  16. $EM_Bookings = $EM_Event->get_bookings();
  17. if( count($EM_Bookings->bookings) > 0 ){
  18.     ?>
  19.     <ul class="event-attendees">
  20.     <?php
  21.     foreach( $EM_Bookings as $EM_Booking){ /* @var $EM_Booking EM_Booking */
  22.         if($EM_Booking->booking_status == 1 && !in_array($EM_Booking->get_person()->ID, $people) ){
  23.             $people[] = $EM_Booking->get_person()->ID;
  24.             echo '<li>'. $EM_Booking->get_person()->get_name() . ' - ' . $EM_Booking->get_spaces() . ' space(s)' .'</li>';
  25.         }elseif($EM_Booking->booking_status == 1 && $EM_Booking->is_no_user() ){
  26.             echo '<li>'. $EM_Booking->get_person()->get_name() . ' - ' . $EM_Booking->get_spaces() . ' space(s)' .'</li>';
  27.         }
  28.     }
  29.     ?>
  30.     </ul>
  31.     <?php
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement