Created
April 27, 2015 15:56
-
-
Save bmoredrew/dcc7d04b23e785f6c0bb to your computer and use it in GitHub Desktop.
Front-end Attendee List WooCommerce WooTickets Events Calendar Plugin
This file contains hidden or 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 | |
global $current_user; | |
get_currentuserinfo(); | |
if (is_user_logged_in() && $current_user->ID == $post->post_author) { | |
// Build a list of attendees | |
$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) | |
// 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']]++; | |
} | |
} | |
if (count($customerList) > 0) { | |
echo ' | |
<div class="woocommerce" id="attendee-list"> | |
<table class="shop_table shop_table_responsive my_account_orders"> | |
<thead> | |
<tr> | |
<th class="order-number"><span class="nobr">Status</span></th> | |
<th class="order-date"><span class="nobr">Name</span></th> | |
<th class="order-status"><span class="nobr">Email</span></th> | |
<th class="order-total"><span class="nobr">Phone</span></th> | |
<th class="order-actions"><span class="nobr">Qty</span></th> | |
</tr> | |
</thead> | |
<tbody> | |
'; | |
foreach ($customerList as $orderID => $totalAttendees) { | |
$order = new WC_Order($orderID); | |
$attendees = "$totalAttendees"; | |
echo '<tr class="order">'; | |
//Order Status | |
echo '<td class="order-number" data-title="Order Number">'; | |
echo $order->status; | |
echo "</td>"; | |
//Customer Name | |
echo '<td class="order-date" data-title="Date">'; | |
echo $order->billing_first_name; | |
echo " "; | |
echo $order->billing_last_name; | |
echo "</td>"; | |
//Billing Email | |
echo '<td class="order-status" data-title="Status" style="text-align:left; white-space:nowrap;">'; | |
echo $order->billing_email; | |
echo "</td>"; | |
//Billing Phone | |
echo '<td class="order-total" data-title="Total">'; | |
echo $order->billing_phone; | |
echo "</td>"; | |
//Total Tickets Purchased | |
echo '<td class="order-actions">'; | |
echo $attendees; | |
echo "</td>"; | |
echo '</tr>'; | |
// echo "{$order->billing_first_name} {$order->billing_last_name} {$order->billing_email} {$order->billing_phone} – $attendees"; | |
} | |
echo ' | |
</tbody> | |
</table> | |
</div> | |
'; | |
} | |
} | |
else | |
{ | |
//nothing | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment