Skip to content

Instantly share code, notes, and snippets.

@GeoffEW
Last active February 24, 2020 09:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeoffEW/e6f41d41d7930c8e63642aeadcfb29b8 to your computer and use it in GitHub Desktop.
Save GeoffEW/e6f41d41d7930c8e63642aeadcfb29b8 to your computer and use it in GitHub Desktop.
* Renders the attendee list for an event and all the attendee information
<?php
/**
* Renders the attendee list for an event
*
* Override this template in your own theme by creating a file at:
*
* [your-theme]/tribe-events/attendees-list.php
*
* @version 4.3.5b
*
*/
?>
<div class='tribe-attendees-list-container'>
<h2 class="tribe-attendees-list-title"><?php esc_html_e( 'Who\'s Attending', 'event-tickets-plus' ) ?></h2>
<p><?php echo esc_html( sprintf( _n( 'One person is attending %2$s', '%d people are attending %s', $attendees_total, 'event-tickets-plus' ), $attendees_total, get_the_title( $event->ID ) ) ); ?></p>
<ul class='tribe-attendees-list'>
<?php
/* Add more information to the attendee output */
global $post;
$attendees = Tribe__Tickets__Tickets::get_event_attendees( $post->ID );
foreach ( $attendees as $key => $attendee ) {
if ( isset( $attendee['attendee_id'] ) ) {
echo '<li>';
echo '<h5>' . $attendee['purchaser_name'] . '</h5>';
$ticket = get_post( $attendee['product_id'] );
if ( !empty( $ticket ) ) {
$meta = Tribe__Tickets_Plus__Main::instance()->meta();
if ( $meta->meta_enabled( $ticket->ID ) ) {
$meta_fields = $meta->get_meta_fields_by_ticket( $ticket->ID );
if ( !empty($meta_fields) ) echo '<ul>';
foreach ( $meta_fields as $field ) {
$field_options = $field->get_field_settings();
echo '<li>' . $field_options->label . ': ' . $field->get_field_value( $attendee['attendee_id'] ) .'</li>';
}
if ( !empty($meta_fields) ) echo '</ul>';
}
}
echo '</li>';
}
} ?>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment