Skip to content

Instantly share code, notes, and snippets.

@imath
Created November 11, 2013 16:15
Show Gist options
  • Save imath/7415781 to your computer and use it in GitHub Desktop.
Save imath/7415781 to your computer and use it in GitHub Desktop.
Displays the list of attendees when on single event page of WordPress plugins "Events Manager". This trick requires BuddyPress to run.
<?php
/**
* Script to copy in your activated theme functions.php for instance
* Make sure BuddyPress and Events Manager are activated on your blog before using this trick
*/
// beginning of the code to copy paste
function imath_displays_confirmed_attendees( $output = '', $object = false, $target = '' ) {
if( !function_exists( 'buddypress' ) )
return $output;
if( empty( $output ) || empty( $object ) )
return $output;
$attendees = $object->get_bookings();
if( !is_array( $attendees->bookings ) || count( $attendees->bookings ) < 1 )
return $output;
$new_output = '<div id="attendees"><h3>Ils viennent !</h3><ul>';
$list_confirmed = array();
foreach( $attendees->bookings as $attendee ) {
if( !empty( $attendee->booking_status ) && !empty( $attendee->person_id ) ) {
$list_confirmed[] = $attendee->person_id;
$new_output .= '<li><a href="'.bp_core_get_user_domain( $attendee->person_id ).'">' . bp_core_fetch_avatar( array( 'item_id' => $attendee->person_id, 'object' => 'user', 'type' => 'thumb') ) . ' '. bp_core_get_user_displayname( $attendee->person_id ) .'</a></li>';
}
}
if( !empty( $list_confirmed ) )
$output .= $new_output . '</ul></div>';
return $output;
}
add_filter( 'em_event_output_single', 'imath_displays_confirmed_attendees', 10, 3 );
// end of the code to copy paste
@solhuebner
Copy link

It would be great if I could code like you :)

@cheey2003
Copy link

Thanks a lot - you saved my day! 👍

@winstart
Copy link

winstart commented Mar 3, 2017

where do i put this code??

@PascaleSom
Copy link

Same question as @winstart ! this is exactly what I have been looking for for several days !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment