protected function calculate_totals()
 {
     $all_attendees = Tribe__Tickets__Tickets::get_event_attendees($this->event_id);
     $total_attendees = count($all_attendees);
     $this->total_checked_in = Tribe__Tickets__Tickets::get_event_checkedin_attendees_count($this->event_id);
     $this->total_not_checked_in = $total_attendees - $this->total_checked_in;
     $this->total_deleted = Tribe__Tickets__Attendance::instance($this->event_id)->get_deleted_attendees_count();
 }
Example #2
0
 /**
  * Deletes a ticket.
  *
  * Note that the total sales/purchases figure maintained by WPEC is not adjusted on the
  * basis that deleting an attendee does not mean the sale didn't go through; this is
  * a change in behaviour from the 4.0.x releases.
  *
  * @param $event_id
  * @param $ticket_id
  *
  * @return bool
  */
 public function delete_ticket($event_id, $ticket_id)
 {
     // Ensure we know the event, order and product IDs (the event ID may not have been passed in)
     if (empty($event_id)) {
         $event_id = get_post_meta($ticket_id, self::ATTENDEE_EVENT_KEY, true);
     }
     $order_id = get_post_meta($ticket_id, self::ATTENDEE_ORDER_KEY, true);
     $product_id = get_post_meta($ticket_id, self::ATTENDEE_PRODUCT_KEY, true);
     // Try to kill the actual ticket/attendee post
     $delete = wp_delete_post($ticket_id, true);
     if (is_wp_error($delete)) {
         return false;
     }
     /* Class exists check exists to avoid bumping Tribe__Tickets_Plus__Main::REQUIRED_TICKETS_VERSION
      * during a minor release; as soon as we are able to do that though we can remove this safeguard.
      *
      * @todo remove class_exists() check once REQUIRED_TICKETS_VERSION >= 4.2
      */
     if (class_exists('Tribe__Tickets__Attendance')) {
         Tribe__Tickets__Attendance::instance($event_id)->increment_deleted_attendees_count();
     }
     do_action('eddtickets_ticket_deleted', $ticket_id, $event_id, $product_id, $order_id);
     return true;
 }
Example #3
0
$event_id = $this->attendees_table->event->ID;
$event = $this->attendees_table->event;
$tickets = Tribe__Tickets__Tickets::get_event_tickets($event_id);
$post_type_object = get_post_type_object($event->post_type);
$checkedin = Tribe__Tickets__Tickets::get_event_checkedin_attendees_count($event_id);
$total_sold = 0;
$total_pending = 0;
$total_deleted = 0;
$total_completed = 0;
foreach ($tickets as $ticket) {
    $total_sold += $ticket->qty_sold();
    $total_pending += $ticket->qty_pending();
}
$total_completed = $total_sold - $total_pending;
$total_attendees = Tribe__Tickets__Tickets::get_event_attendees_count($event_id);
$total_deleted = Tribe__Tickets__Attendance::instance($event_id)->get_deleted_attendees_count();
?>

<div class="wrap tribe-attendees-page">
	<h1><?php 
esc_html_e('Attendees', 'event-tickets');
?>
</h1>
	<div id="tribe-attendees-summary" class="welcome-panel">
		<div class="welcome-panel-content">
			<h3><?php 
echo '<a href="' . get_edit_post_link($event_id) . '" title="' . esc_attr__('Edit Event', 'event-tickets') . '">' . wp_kses(apply_filters('tribe_events_tickets_attendees_event_title', $event->post_title, $event->ID), array()) . '</a>';
?>
</h3>
			<p class="about-description"><?php 
echo '<a href="' . get_permalink($event_id) . '" title="' . esc_attr__('See Event Page', 'event-tickets') . '">' . get_permalink($event_id) . '</a>';
Example #4
0
 /**
  * Deletes a ticket
  *
  * @param $event_id
  * @param $ticket_id
  *
  * @return bool
  */
 public function delete_ticket($event_id, $ticket_id)
 {
     // Ensure we know the event and product IDs (the event ID may not have been passed in)
     if (empty($event_id)) {
         $event_id = get_post_meta($ticket_id, self::ATTENDEE_EVENT_KEY, true);
     }
     // Additional check (in case we were passed an invalid ticket ID and still can't determine the event)
     if (empty($event_id)) {
         return false;
     }
     $product_id = get_post_meta($ticket_id, self::ATTENDEE_PRODUCT_KEY, true);
     // For attendees whose status ('going' or 'not going') for whom a stock adjustment is required?
     $rsvp_options = $this->tickets_view->get_rsvp_options(null, false);
     $attendee_status = get_post_meta($ticket_id, self::ATTENDEE_RSVP_KEY, true);
     $adjustment = isset($rsvp_options[$attendee_status]['decrease_stock_by']) ? absint($rsvp_options[$attendee_status]['decrease_stock_by']) : false;
     // Adjust the sales figure if required
     if ($adjustment) {
         $sales = (int) get_post_meta($product_id, 'total_sales', true);
         update_post_meta($product_id, 'total_sales', $sales - $adjustment);
     }
     //Store name so we can still show it in the attendee list
     $attendees = $this->get_attendees($event_id);
     $post_to_delete = get_post($ticket_id);
     foreach ((array) $attendees as $attendee) {
         if ($attendee['product_id'] == $ticket_id) {
             update_post_meta($attendee['attendee_id'], $this->deleted_product, esc_html($post_to_delete->post_title));
         }
     }
     // Try to kill the actual ticket/attendee post
     $delete = wp_delete_post($ticket_id, true);
     if (is_wp_error($delete)) {
         return false;
     }
     Tribe__Tickets__Attendance::instance($event_id)->increment_deleted_attendees_count();
     do_action('tickets_rsvp_ticket_deleted', $ticket_id, $event_id, $product_id);
     Tribe__Post_Transient::instance()->delete($event_id, Tribe__Tickets__Tickets::ATTENDEES_CACHE);
     return true;
 }
Example #5
0
 /**
  * Deletes a ticket
  *
  * @param $event_id
  * @param $ticket_id
  *
  * @return bool
  */
 public function delete_ticket($event_id, $ticket_id)
 {
     // Ensure we know the event and product IDs (the event ID may not have been passed in)
     if (empty($event_id)) {
         $event_id = get_post_meta($ticket_id, self::ATTENDEE_EVENT_KEY, true);
     }
     $product_id = get_post_meta($ticket_id, self::ATTENDEE_PRODUCT_KEY, true);
     // Decrement the sales figure
     $sales = (int) get_post_meta($product_id, 'total_sales', true);
     update_post_meta($product_id, 'total_sales', --$sales);
     //Store name so we can still show it in the attendee list
     $attendees = $this->get_attendees($event_id);
     $post_to_delete = get_post($ticket_id);
     foreach ((array) $attendees as $attendee) {
         if ($attendee['product_id'] == $ticket_id) {
             update_post_meta($attendee['attendee_id'], $this->deleted_product, esc_html($post_to_delete->post_title));
         }
     }
     // Try to kill the actual ticket/attendee post
     $delete = wp_delete_post($ticket_id, true);
     if (is_wp_error($delete)) {
         return false;
     }
     Tribe__Tickets__Attendance::instance($event_id)->increment_deleted_attendees_count();
     do_action('tickets_rsvp_ticket_deleted', $ticket_id, $event_id, $product_id);
     return true;
 }
Example #6
0
 /**
  * Deletes a ticket.
  *
  * @param $unused_event_id
  * @param $ticket_id
  * @return bool
  */
 public function delete_ticket($unused_event_id, $ticket_id)
 {
     $delete = wp_delete_post($ticket_id, true);
     /* Class exists check exists to avoid bumping Tribe__Tickets_Plus__Main::REQUIRED_TICKETS_VERSION
      * during a minor release; as soon as we are able to do that though we can remove this safeguard.
      *
      * @todo remove class_exists() check once REQUIRED_TICKETS_VERSION >= 4.2
      */
     if (class_exists('Tribe__Tickets__Attendance')) {
         Tribe__Tickets__Attendance::instance($event_id)->increment_deleted_attendees_count();
     }
     return !is_wp_error($delete);
 }