Last active
August 29, 2015 14:01
-
-
Save joshfeck/55f20059953119b46b34 to your computer and use it in GitHub Desktop.
Displays an attendee list after the content on the event details page. Displays the gravatar, first name, and last name of each attendee registered for an event. Requires Event Espresso 4.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
// prints a per event attendee list right after the event details on a single event page | |
// you can change the action hook that's on the next line to display the list in another location | |
add_action( 'AHEE_event_details_after_the_content', 'ee_attendee_list' ); | |
function ee_attendee_list(){ | |
global $wpdb, $post; | |
if(is_singular()){ | |
echo '<ul class="attendee-list">'; | |
$sql = "SELECT ATT_fname, ATT_lname, ATT_email "; | |
$sql .= "FROM {$wpdb->prefix}esp_attendee_meta "; | |
$sql .= "INNER JOIN {$wpdb->prefix}esp_registration "; | |
$sql .= "ON {$wpdb->prefix}esp_attendee_meta.ATT_ID = {$wpdb->prefix}esp_registration.ATT_ID "; | |
$sql .= "WHERE {$wpdb->prefix}esp_registration.EVT_ID = %d"; | |
$attendees = $wpdb->get_results( $wpdb->prepare( $sql, $post->ID )); | |
foreach($attendees as $attendee){ | |
$fname = $attendee->ATT_fname; | |
$lname = $attendee->ATT_lname; | |
$email = $attendee->ATT_email; | |
$gravatar = get_avatar( $email, '64', 'identicon' ); | |
$html = '<li>'. $gravatar .'<span>'. $fname .' '. $lname . '</span></li>'; | |
echo $html; | |
} | |
echo '</ul>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment