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(); }
/** * @param array $record * * @return int|bool Either the new RSVP ticket post ID or `false` on failure. */ public function create_post(array $record) { $event = $this->get_event_from($record); $data = $this->get_ticket_data_from($record); $ticket_id = $this->tickets->ticket_add($event->ID, $data); $ticket_name = $this->get_value_by_key($record, 'ticket_name'); $cache_key = $ticket_name . '-' . $event->ID; self::$ticket_name_cache[$cache_key] = true; return $ticket_id; }
/** * Adds the tickets data to the event Object * * @param array $data * @param array $args * @param WP_Post $post * * @return array */ public function add_ticket_data($data, $args, $post) { if (!tribe_events_has_tickets($post->ID)) { return $data; } $tickets = Tribe__Tickets__Tickets::get_all_event_tickets($post->ID); // Reset it $data->offers = array(); foreach ($tickets as $ticket) { $data->offers[] = $this->get_offer($ticket, $post); } return $data; }
/** * Gets the sum of all the stock for all the tickets associated to an event. * * @param int|string|WP_Post $event Either an event post `ID` or a `WP_Post` instance for an event. */ public function get_total_for($event) { $event = get_post($event); $supported_post_types = Tribe__Tickets__Main::instance()->post_types(); if (empty($event) || !in_array($event->post_type, $supported_post_types)) { return new WP_Error('not-an-event', sprintf('The post with ID "%s" is not an event.', $event->ID)); } $sum = 0; $all_tickets = Tribe__Tickets__Tickets::get_all_event_tickets($event->ID); /** @var Tribe__Tickets__Ticket_Object $ticket */ foreach ($all_tickets as $ticket) { $sum += $ticket->stock(); } // return the sum return $sum; }
/** * Includes the tickets metabox inside the Event edit screen * * @param WP_Post $post */ public function do_meta_box($post) { $startMinuteOptions = Tribe__View_Helpers::getMinuteOptions(null); $endMinuteOptions = Tribe__View_Helpers::getMinuteOptions(null); $startHourOptions = Tribe__View_Helpers::getHourOptions(null, true); $endHourOptions = Tribe__View_Helpers::getHourOptions(null, false); $startMeridianOptions = Tribe__View_Helpers::getMeridianOptions(null, true); $endMeridianOptions = Tribe__View_Helpers::getMeridianOptions(null); $show_global_stock = Tribe__Tickets__Tickets::global_stock_available(); $tickets = Tribe__Tickets__Tickets::get_event_tickets($post->ID); $global_stock = new Tribe__Tickets__Global_Stock($post->ID); include $this->path . 'src/admin-views/meta-box.php'; }
/** * Includes the tickets metabox inside the Event edit screen * * @param $post_id */ public function do_meta_box($post_id) { $startMinuteOptions = Tribe__View_Helpers::getMinuteOptions(null); $endMinuteOptions = Tribe__View_Helpers::getMinuteOptions(null); $startHourOptions = Tribe__View_Helpers::getHourOptions(null, true); $endHourOptions = Tribe__View_Helpers::getHourOptions(null, false); $startMeridianOptions = Tribe__View_Helpers::getMeridianOptions(null, true); $endMeridianOptions = Tribe__View_Helpers::getMeridianOptions(null); $tickets = Tribe__Tickets__Tickets::get_event_tickets($post_id); include $this->path . 'src/admin-views/meta-box.php'; }
/** * Fetches from the Cached attendees list the ones that are relevant for this user and event * Important to note that this method will bring the attendees from RSVP * * @param int $event_id The Event ID it relates to * @param int|null $user_id An Optional User ID * @return array Array with the RSVP attendees */ public function get_event_rsvp_attendees($event_id, $user_id = null) { $all_attendees = Tribe__Tickets__Tickets::get_event_attendees($event_id); $attendees = array(); foreach ($all_attendees as $key => $attendee) { // Skip Non RSVP if ('rsvp' !== $attendee['provider_slug']) { continue; } // If we have a user_id then test it and ignore the ones that don't have it if (!is_null($user_id)) { if (empty($attendee['user_id']) || $attendee['user_id'] != $user_id) { continue; } } $attendees[] = $attendee; } return $attendees; }
/** * Class constructor */ public function __construct() { /* Set up some parent's vars */ $this->pluginName = 'WooCommerce'; $this->pluginSlug = 'wootickets'; $this->pluginPath = trailingslashit(EVENT_TICKETS_PLUS_DIR); $this->pluginDir = trailingslashit(basename($this->pluginPath)); $this->pluginUrl = trailingslashit(plugins_url($this->pluginDir)); parent::__construct(); $this->hooks(); $this->orders_report(); }
/** * Accepts the post object or ID for a product and, if it represents an event * ticket, returns the corresponding event object. * * If this cannot be determined boolean false will be returned instead. * * @param $possible_ticket * * @return bool|WP_Post */ function tribe_events_get_ticket_event($possible_ticket) { return Tribe__Tickets__Tickets::find_matching_event($possible_ticket); }
/** * Checks the user in, for all the *Tickets modules running. * * @param $ticket_id */ private function _check_in($ticket_id) { $modules = Tribe__Tickets__Tickets::modules(); foreach ($modules as $class => $module) { if (!is_callable(array($class, 'get_instance'))) { continue; } $obj = call_user_func(array($class, 'get_instance')); $obj->checkin($ticket_id, false); } }
/** * Injects a buy/RSVP button into oembeds for events when necessary */ public function inject_buy_button_into_oembed() { $event_id = get_the_ID(); if (!tribe_events_has_tickets($event_id)) { return; } $tickets = Tribe__Tickets__Tickets::get_all_event_tickets($event_id); $has_non_rsvp = false; $available = false; $now = current_time('timestamp'); foreach ($tickets as $ticket) { if ('Tribe__Tickets__RSVP' !== $ticket->provider_class) { $has_non_rsvp = true; } if ($ticket->date_in_range($now) && $ticket->is_in_stock()) { $available = true; } } // if there aren't any tickets available, bail if (!$available) { return; } $button_text = $has_non_rsvp ? __('Buy', 'event-tickets') : __('RSVP', 'event-tickets'); /** * Filters the text that appears in the buy/rsvp button on event oembeds * * @var string The button text * @var int Event ID */ $button_text = apply_filters('event_tickets_embed_buy_button_text', $button_text, $event_id); ob_start(); ?> <a class="tribe-event-buy" href="<?php echo esc_url(tribe_get_event_link()); ?> " title="<?php the_title_attribute(); ?> " rel="bookmark"><?php echo esc_html($button_text); ?> </a> <?php $buy_button = ob_get_clean(); /** * Filters the buy button that appears on event oembeds * * @var string The button markup * @var int Event ID */ echo apply_filters('event_tickets_embed_buy_button', $buy_button, $event_id); }
/** * Fetches from the Cached attendees list the ones that are relevant for this user and event * Important to note that this method will bring the attendees organized by order id * * @param int $event_id The Event ID it relates to * @param int|null $user_id An Optional User ID * @param boolean $include_rsvp If this should include RSVP, which by default is false * @return array List of Attendees grouped by order id */ public function get_event_attendees_by_order($event_id, $user_id = null, $include_rsvp = false) { $attendees = Tribe__Tickets__Tickets::get_event_attendees($event_id); $orders = array(); foreach ($attendees as $key => $attendee) { // Ignore RSVP if we don't tell it specifically if ('rsvp' === $attendee['provider_slug'] && !$include_rsvp) { continue; } // If we have a user_id then test it and ignore the ones that don't have it if (!is_null($user_id)) { if (empty($attendee['user_id']) || $attendee['user_id'] != $user_id) { continue; } } $orders[(int) $attendee['order_id']][] = $attendee; } return $orders; }
<?php /** * Renders a link displayed to customers when they must first login * before being able to purchase tickets. * * @version 4.2 */ $login_url = Tribe__Tickets__Tickets::get_login_url(); ?> <a href="<?php echo esc_attr($login_url); ?> "><?php esc_html_e('Login to purchase', 'event-tickets'); ?> </a>
/** * Gets the "tickets sold" message for a given ticket * * @param Tribe__Tickets__Ticket_Object $ticket Ticket to analyze * * @return string */ function tribe_tickets_get_ticket_stock_message(Tribe__Tickets__Ticket_Object $ticket) { $stock = $ticket->stock(); $sold = $ticket->qty_sold(); $cancelled = $ticket->qty_cancelled(); $pending = $ticket->qty_pending(); $event = Tribe__Tickets__Tickets::find_matching_event($ticket); $global_stock = new Tribe__Tickets__Global_Stock($event->ID); $is_global = Tribe__Tickets__Global_Stock::GLOBAL_STOCK_MODE === $ticket->global_stock_mode(); $is_capped = Tribe__Tickets__Global_Stock::CAPPED_STOCK_MODE === $ticket->global_stock_mode(); $stock_cap = $ticket->global_stock_cap(); // If ticket sales are capped, do not suggest that more than the cap amount are available if ($is_capped && $stock > $stock_cap) { $stock = $stock_cap; } // If it is a global-stock ticket but the global stock level has not yet been set for the event // then return something better than just '0' as the available stock if ($is_global && 0 === $stock && !$global_stock->is_enabled()) { $stock = '<i>' . __('global inventory', 'event-tickets') . '</i>'; } // There may not be a fixed inventory - in which case just report the number actually sold so far if (empty($stock) && $stock !== 0) { $message = sprintf(esc_html__('Sold %d', 'event-tickets'), esc_html($sold)); } else { $cancelled_count = empty($cancelled) ? '' : esc_html(sprintf(_x(' cancelled: %1$d', 'ticket stock message (cancelled stock)', 'event-tickets'), (int) $cancelled)); $pending_count = $pending < 1 ? '' : esc_html(sprintf(__(' pending: %1$d', 'ticket stock message (pending stock)', 'event-tickets'), (int) $pending)); $message = sprintf(esc_html__('Sold %1$d (units remaining: %2$s%3$s%4$s)', 'event-tickets'), esc_html($sold), $stock, $cancelled_count, $pending_count); } return $message; }
/** * Class constructor */ public function __construct() { $main = Tribe__Tickets__Main::instance(); /* Set up some parent's vars */ $this->pluginName = 'RSVP'; $this->pluginPath = $main->plugin_path; $this->pluginUrl = $main->plugin_url; parent::__construct(); $this->init(); $this->hooks(); }
/** * Class constructor */ public function __construct() { $main = Tribe__Tickets__Main::instance(); /* Set up some parent's vars */ $this->pluginName = 'RSVP'; $this->pluginPath = $main->plugin_path; $this->pluginUrl = $main->plugin_url; parent::__construct(); add_action('init', array($this, 'init')); /** * Whenever we are dealing with Redirects we cannot do stuff on `init` * Use: `template_redirect` * * Was running into an issue of `get_permalink( $event_id )` returning * the wrong url because it was too early on the execution */ add_action('template_redirect', array($this, 'generate_tickets')); }
/** * When a ticket type is moved, the tickets need to move with it. This callback takes * care of that process. * * @see Tribe__Tickets__Admin__Move_Ticket_Types::move_ticket_type() * * @param int $ticket_type_id * @param int $destination_post_id * @param int $src_post_id * @param int $instigator_id */ public function move_all_tickets_for_type($ticket_type_id, $destination_post_id, $src_post_id, $instigator_id) { foreach (Tribe__Tickets__Tickets::get_event_attendees($src_post_id) as $issued_ticket) { // We're only interested in tickets of the specified type if ((int) $ticket_type_id !== (int) $issued_ticket['product_id']) { continue; } if (!class_exists($issued_ticket['provider'])) { continue; } $issued_ticket_id = $issued_ticket['attendee_id']; // Move the ticket to the destination post $event_key = constant($issued_ticket['provider'] . '::ATTENDEE_EVENT_KEY'); update_post_meta($issued_ticket_id, $event_key, $destination_post_id); // Maintain an audit trail $history_message = sprintf(__('This ticket was moved to %1$s from %2$s', 'event-tickets'), '<a href="' . esc_url(get_the_permalink($destination_post_id)) . '" target="_blank">' . get_the_title($destination_post_id) . '</a>', '<a href="' . esc_url(get_the_permalink($src_post_id)) . '" target="_blank">' . get_the_title($src_post_id) . '</a>'); $history_data = array('src_event_id' => $src_post_id, 'tgt_event_id' => $destination_post_id); Tribe__Post_History::load($issued_ticket_id)->add_entry($history_message, $history_data); } }
/** * Renders the Orders page */ public function orders_page_inside() { $this->orders_table->prepare_items(); $event_id = isset($_GET['event_id']) ? intval($_GET['event_id']) : 0; $event = get_post($event_id); $tickets = Tribe__Tickets__Tickets::get_event_tickets($event_id); /** * Filters whether or not fees are being passed to the end user (purchaser) * * @var boolean $pass_fees Whether or not to pass fees to user * @var int $event_id Event post ID */ Tribe__Tickets_Plus__Commerce__WooCommerce__Orders__Table::$pass_fees_to_user = apply_filters('tribe_tickets_pass_fees_to_user', true, $event_id); /** * Filters the fee percentage to apply to a ticket/order * * @var float $fee_percent Fee percentage */ Tribe__Tickets_Plus__Commerce__WooCommerce__Orders__Table::$fee_percent = apply_filters('tribe_tickets_fee_percent', 0, $event_id); /** * Filters the flat fee to apply to a ticket/order * * @var float $fee_flat Flat fee */ Tribe__Tickets_Plus__Commerce__WooCommerce__Orders__Table::$fee_flat = apply_filters('tribe_tickets_fee_flat', 0, $event_id); ob_start(); $this->orders_table->display(); $table = ob_get_clean(); $organizer = get_user_by('id', $event->post_author); $event_revenue = Tribe__Tickets_Plus__Commerce__WooCommerce__Orders__Table::event_revenue($event_id); $event_sales = Tribe__Tickets_Plus__Commerce__WooCommerce__Orders__Table::event_sales($event_id); $event_fees = Tribe__Tickets_Plus__Commerce__WooCommerce__Orders__Table::event_fees($event_id); $tickets_sold = array(); $total_sold = 0; $total_pending = 0; $total_profit = 0; $total_completed = 0; foreach ($tickets as $ticket) { if (empty($tickets_sold[$ticket->name])) { $tickets_sold[$ticket->name] = array('ticket' => $ticket, 'has_stock' => !$ticket->stock(), 'sku' => get_post_meta($ticket->ID, '_sku', true), 'sold' => 0, 'pending' => 0, 'completed' => 0); } $stock = $ticket->stock(); $sold = $ticket->qty_sold(); $cancelled = $ticket->qty_cancelled(); $net_sold = $sold - $cancelled; if ($net_sold < 0) { $net_sold = 0; } $tickets_sold[$ticket->name]['sold'] += $net_sold; $tickets_sold[$ticket->name]['pending'] += absint($ticket->qty_pending()); $tickets_sold[$ticket->name]['completed'] += absint($tickets_sold[$ticket->name]['sold']) - absint($tickets_sold[$ticket->name]['pending']); $total_sold += $net_sold; $total_pending += absint($ticket->qty_pending()); } $total_completed += absint($total_sold) - absint($total_pending); include Tribe__Tickets_Plus__Main::instance()->plugin_path . 'src/admin-views/woocommerce-orders.php'; }
/** * Returns an Array ready for printing of the Attendees List * * @param int|WP_Post $event * @param int $limit * @return array */ public function get_attendees($event, $limit = 20) { $limit = apply_filters('tribe_tickets_plus_attendees_list_limit', $limit); $attendees = Tribe__Tickets__Tickets::get_event_attendees($event); $total = count($attendees); $has_broken = false; $listing = array(); $emails = array(); foreach ($attendees as $key => $attendee) { $html = ''; // Only Check for optout when It's there if (isset($attendee['optout']) && $attendee['optout'] !== false) { continue; } // Skip when we already have another email like this one if (in_array($attendee['purchaser_email'], $emails)) { continue; } if (is_numeric($limit) && $limit < $key + 1) { $has_broken = true; } if ($has_broken) { $html .= '<span class="tribe-attendees-list-hidden">'; } else { $html .= '<span class="tribe-attendees-list-shown">'; } $html .= get_avatar($attendee['purchaser_email'], 40, '', $attendee['purchaser_name']); $html .= '</span>'; $emails[] = $attendee['purchaser_email']; $listing[$attendee['attendee_id']] = $html; } if ($has_broken) { $listing['show-more'] = '<a href="#show-all-attendees" data-offset="' . esc_attr($limit) . '" title="' . esc_attr__('Load all attendees', 'event-tickets-plus') . '" class="tribe-attendees-list-showall avatar">' . get_avatar('', 40, '', esc_attr__('Load all attendees', 'event-tickets-plus')) . '</a>'; } return $listing; }
/** * Class constructor */ public function __construct() { $main = Tribe__Tickets__Main::instance(); $this->tickets_view = Tribe__Tickets__Tickets_View::instance(); /* Set up some parent's vars */ $this->pluginName = _x('RSVP', 'ticket provider', 'event-tickets'); $this->pluginPath = $main->plugin_path; $this->pluginUrl = $main->plugin_url; parent::__construct(); $this->hooks(); add_action('init', array($this, 'init')); /** * Whenever we are dealing with Redirects we cannot do stuff on `init` * Use: `template_redirect` * * Was running into an issue of `get_permalink( $event_id )` returning * the wrong url because it was too early on the execution */ add_action('template_redirect', array($this, 'generate_tickets')); add_action('event_tickets_attendee_update', array($this, 'update_attendee_data'), 10, 3); add_action('event_tickets_after_attendees_update', array($this, 'maybe_send_tickets_after_status_change')); }
<?php $this->attendees_table->prepare_items(); $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_completed = 0; foreach ($tickets as $ticket) { $total_sold += $ticket->qty_sold() + $ticket->qty_pending(); $total_pending += $ticket->qty_pending(); } $total_completed = $total_sold - $total_pending; ?> <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>';
/** * Class constructor */ public function __construct() { /* Set up some parent's vars */ $this->pluginName = __('Easy Digital Downloads', 'edd'); $this->pluginSlug = 'eddtickets'; $this->pluginPath = trailingslashit(EVENT_TICKETS_PLUS_DIR); $this->pluginDir = trailingslashit(basename($this->pluginPath)); $this->pluginUrl = trailingslashit(plugins_url($this->pluginDir)); $this->mailer = new Tribe__Tickets_Plus__Commerce__EDD__Email(); $this->stock_control = new Tribe__Tickets_Plus__Commerce__EDD__Stock_Control(); parent::__construct(); $this->hooks(); }
<?php $this->attendees_table->prepare_items(); $event_id = $this->attendees_table->event->ID; $event = $this->attendees_table->event; $tickets = Tribe__Tickets__Tickets::get_event_tickets($event_id); ?> <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"> <div class="welcome-panel-column-container"> <?php /** * Fires before the individual panels within the attendee screen summary * are rendered. * * @param int $event_id */ do_action('tribe_events_tickets_attendees_event_details_top', $event_id); ?> <div class="welcome-panel-column welcome-panel-first"> <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>'; ?>
/** * Retrieves the meta fields for all tickets associated with the specified event. * * @param $event_id * * @return array */ public function get_meta_fields_by_event($event_id) { $fields = array(); foreach (Tribe__Tickets__Tickets::get_event_tickets($event_id) as $ticket) { $meta_fields = $this->get_meta_fields_by_ticket($ticket->ID); if (is_array($meta_fields) && !empty($meta_fields)) { $fields = array_merge($fields, $meta_fields); } } /** * Returns a list of meta fields in use with various tickets associated with * a specific event. * * @var array $fields * @var int $event_id */ return apply_filters('tribe_tickets_plus_get_meta_fields_by_event', $fields, $event_id); }
/** * Prepares the list of items for displaying. */ public function prepare_items() { $this->process_actions(); $event_id = isset($_GET['event_id']) ? $_GET['event_id'] : 0; $items = Tribe__Tickets__Tickets::get_event_attendees($event_id); $this->items = $items; $total_items = count($this->items); $per_page = $total_items; $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => 1)); }
/** * Attempts to load the specified ticket type post object. * * @param int $ticket_id * * @return Tribe__Tickets__Ticket_Object|null */ public static function load_ticket_object($ticket_id) { foreach (Tribe__Tickets__Tickets::modules() as $provider_class => $name) { $provider = call_user_func(array($provider_class, 'get_instance')); $event = $provider->get_event_for_ticket($ticket_id); if (!$event) { continue; } $ticket_object = $provider->get_ticket($event->ID, $ticket_id); if ($ticket_object) { return $ticket_object; } } return null; }
/** * Class constructor */ public function __construct() { /* Set up some parent's vars */ $this->pluginName = 'WPEC'; $this->pluginSlug = 'wpec'; $this->pluginPath = trailingslashit(EVENT_TICKETS_PLUS_DIR); $this->pluginDir = trailingslashit(basename($this->pluginPath)); $this->pluginUrl = trailingslashit(plugins_url($this->pluginDir)); parent::__construct(); $this->hooks(); }
/** * Shows the tickets form in the front end * * @param $content * @return void */ public function front_end_tickets_form($content) { $post = $GLOBALS['post']; if (!empty($post->post_parent)) { $post = get_post($post->post_parent); } $tickets = self::get_tickets($post->ID); if (empty($tickets)) { return; } $must_login = !is_user_logged_in() && $this->login_required(); $global_stock_enabled = $this->uses_global_stock($post->ID); Tribe__Tickets__Tickets::add_frontend_stock_data($tickets); include $this->getTemplateHierarchy('wootickets/tickets'); }
/** * @var WP_Post $post * @var bool $show_global_stock * @var Tribe__Tickets__Global_Stock $global_stock */ // Don't load directly if (!defined('ABSPATH')) { die('-1'); } $header_id = get_post_meta(get_the_ID(), $this->image_header_field, true); $header_id = !empty($header_id) ? $header_id : ''; $header_img = ''; if (!empty($header_id)) { $header_img = wp_get_attachment_image($header_id, 'full'); } $modules = Tribe__Tickets__Tickets::modules(); ?> <table id="event_tickets" class="eventtable"> <?php wp_nonce_field('tribe-tickets-meta-box', 'tribe-tickets-post-settings'); if (get_post_meta(get_the_ID(), '_EventOrigin', true) === 'community-events') { ?> <tr> <td colspan="2" class="tribe_sectionheader updated"> <p class="error-message"><?php esc_html_e('This event was created using Community Events. Are you sure you want to sell tickets for it?', 'event-tickets'); ?> </p> </td> </tr>
$this->attendees_table->prepare_items(); $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