Forum Replies Created
-
AuthorPosts
-
JeffParticipant
Have done a little bit of work since posting the above comment on the code linked previously.
The snippet works if pasted into single-event.php on or around line 83. I’m going to paste a transitional version of it. For our purposes we will want something suitable for printing from new window opened by button-link on Frontend Event-related pages (i.e., list view, calendar as well as single event view) for logged-in users with >n permission levels. But this is the starting point. (And I’d still welcome assistance – I think you ought to make this a core feature…)
<?php // Build a list of attendees // provided code (below) did not work: // Build a list of attendees //$attendeeList = TribeEventsTickets::get_event_attendees(get_the_ID()); // $customerList = array(); // but substituting $event_id for get_the_ID() did $attendeeList = TribeEventsTickets::get_event_attendees($event_id); $customerList = array(); // Build a list of customers (by order ID) if (is_array($attendeeList)) { foreach ($attendeeList as $attendeeData) //All orders are being treated as completed order, also suggested code snippet didn't work // 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']]++; } } //} for deleted if statement intended to count for compelted orders only // Iterate through and print the customer's deets // in an Ordered list (changed from unordered so have ready count of purchases) // though final version may revert to unordered once columns are fully set up, probably more like attendee email in // attendees-email.php if (count($customerList) > 0) { echo '<ol>'; 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 '</ol>'; } // Is no one attending? else { echo '<p>No one is attending. Come on, sign up!'; } ?>
-
AuthorPosts