Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Build a list of attendees
- $attendeeList = TribeEventsTickets::get_event_attendees(get_the_ID());
- $customerList = array();
- // Build a list of customers (by order ID)
- if (is_array($attendeeList)) {
- foreach ($attendeeList as $attendeeData)
- // To dovetail with WooTickets default mode of operation we're only going to concern
- // ourselves with completed orders, but this clause could be changed
- if ($attendeeData['order_status'] === 'completed') {
- // Record the order ID and number of attendees per order
- if (!isset($customerList[$attendeeData['order_id']])) {
- $customerList[$attendeeData['order_id']] = 1;
- }
- else {
- $customerList[$attendeeData['order_id']]++;
- }
- }
- }
- // Iterate through and print the customer's deets in an unordered list
- if (count($customerList) > 0) {
- echo '<ul>';
- foreach ($customerList as $orderID => $totalAttendees) {
- $order = new WC_Order($orderID);
- $gravatar = '<img src="http://www.gravatar.com/avatar/'.md5(strtolower(trim($order->billing_email))).'">';
- $attendees = "$totalAttendees person(s)";
- echo "<li> $gravatar {$order->billing_first_name} {$order->billing_last_name} – $attendees</li>";
- }
- echo '</ul>';
- }
- // Is no one attending?
- else {
- echo '<p>No one is attending. Come on, sign up!';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement