eventsmanager

Custom buddypress profile link for #_ATTENDEESLIST

Aug 5th, 2015
556
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. This custom template will make the username link to buddypress profile page using placeholder #_ATTENDEELIST
  3. Instructions:
  4. 1. Create these folders inside your current theme directory plugins/events-manager/placeholders
  5. eg. wp-content/themes/Your Theme/plugins/events-manager/placeholders
  6. 2. Inside the above custom directory, create new php file attendeeslist.php
  7. eg. wp-content/themes/Your Theme/plugins/events-manager/placeholders/attendeeslist.php
  8. 3. edit attendeeslist.php and paste the below snippet
  9. 4. use placeholder #_ATTENDEESLIST in your formatting options at Events > Settings > Formatting > Events
  10. */
  11. <?php
  12. /* @var $EM_Event EM_Event */
  13. $people = array();
  14. $EM_Bookings = $EM_Event->get_bookings();
  15. if( count($EM_Bookings->bookings) > 0 ){
  16. ?>
  17. <ul class="event-attendees">
  18. <?php
  19. $guest_bookings = get_option('dbem_bookings_registration_disable');
  20. $guest_booking_user = get_option('dbem_bookings_registration_user');
  21. foreach( $EM_Bookings as $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>'.bp_core_get_userlink($EM_Booking->get_person()->ID).'</li>';
  25. }elseif($EM_Booking->booking_status == 1 && $guest_bookings && $EM_Booking->get_person()->ID == $guest_booking_user ){
  26. echo '<li>'.bp_core_get_userlink($EM_Booking->get_person()->ID).'</li>';
  27. }
  28. }
  29. ?>
  30. </ul>
  31. <?php
  32. }
RAW Paste Data