Advertisement
eventsmanager

Custom #_ATTENDEESLIST

Jun 10th, 2013
1,861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.49 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.     $guest_bookings = get_option('dbem_bookings_registration_disable');
  22.     $guest_booking_user = get_option('dbem_bookings_registration_user');
  23.     foreach( $EM_Bookings as $EM_Booking){
  24.         if($EM_Booking->booking_status == 1){
  25.             $attendees_list = "";
  26.             $attendees = $EM_Booking->booking_meta['attendees'];
  27.             if ( !empty($attendees) ){
  28.            
  29.                 foreach($attendees as $key => $value) {
  30.                     $attendees_list = "<ul style='padding-left:20px'>";
  31.                     foreach($value as $key_attendee => $value_attendee) {
  32.                         $attendees_list .= "<li>".$value_attendee["attendee_name"]."</li>";
  33.                     }
  34.                     $attendees_list .= "</ul>";
  35.                 }
  36.             }
  37.             echo '<li>'. $EM_Booking->get_person()->get_name() .' '. $EM_Booking->output("#_BOOKINGFORMCUSTOM{field_id}").$attendees_list.'</li>';     
  38.         }
  39.     }
  40.     ?>
  41.     </ul>
  42.     <?php
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement