Skip to content

Instantly share code, notes, and snippets.

@elimn
Created January 5, 2016 19:06
Show Gist options
  • Save elimn/b801f7aff71737e3a20b to your computer and use it in GitHub Desktop.
Save elimn/b801f7aff71737e3a20b to your computer and use it in GitHub Desktop.
MT | ETP | List attendees on the single events page
<?php
/**
* List attendees on the single events page (WooCommerce-based orders
* in this example).
*
* This is just a quick hack/possible starting point - be nice to add a
* helper/template tag within Event Tickets to get the attendee list or
* change the public visibility of Tribe__Tickets__Tickets::get_attendees()
* to make it easier for folks to roll their own.
*
* Important! This class would of course have to be defined later than
* Tribe__Tickets_Plus__Commerce__WooCommerce__Main (ie, don't include
* this until after a suitably late point like the init action and until
* you have confirmed the superclass exists).
*/
class FrontendAttendeeData extends Tribe__Tickets_Plus__Commerce__WooCommerce__Main {
public function hooks() {
parent::hooks();
add_action( 'tribe_events_single_event_before_the_content', array( $this, 'frontend_attendees_list' ) );
}
public function frontend_attendees_list() {
$attendees = $this->get_attendees( get_the_ID() );
if ( empty( $attendees ) ) return;
echo '<h4> Confirmed attendees </h4> <ul>';
foreach ( $attendees as $attendee )
echo '<li>' . $attendee['purchaser_name'] . '</li>';
echo '</ul>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment