<?php /** * List of RSVP Orders * * Override this template in your own theme by creating a file at [your-theme]/tribe-events/tickets/orders-rsvp.php * * @package TribeEventsCalendar * @version 4.3 * */ if (!defined('ABSPATH')) { die('-1'); } $view = Tribe__Tickets__Tickets_View::instance(); $post_id = get_the_ID(); $post = get_post($post_id); $post_type = get_post_type_object($post->post_type); $user_id = get_current_user_id(); $user_info = get_userdata($user_id); if (!$view->has_rsvp_attendees($post_id, $user_id)) { return; } $attendee_groups = $view->get_event_rsvp_attendees_by_purchaser($post_id, $user_id); ?> <div class="tribe-rsvp"> <h2><?php printf(esc_html__('My RSVPs for This %s', 'event-tickets'), $post_type->labels->singular_name); ?> </h2> <?php
/** * Get all the attendees for an event. It returns an array with the * following fields: * * order_id * order_status * purchaser_name * purchaser_email * optout * ticket * attendee_id * security * product_id * check_in * provider * * @param $event_id * * @return array */ protected function get_attendees($event_id) { $attendees_query = new WP_Query(array('posts_per_page' => -1, 'post_type' => self::ATTENDEE_OBJECT, 'meta_key' => self::ATTENDEE_EVENT_KEY, 'meta_value' => $event_id, 'orderby' => 'ID', 'order' => 'DESC')); if (!$attendees_query->have_posts()) { return array(); } $attendees = array(); foreach ($attendees_query->posts as $attendee) { $checkin = get_post_meta($attendee->ID, $this->checkin_key, true); $security = get_post_meta($attendee->ID, $this->security_code, true); $product_id = get_post_meta($attendee->ID, self::ATTENDEE_PRODUCT_KEY, true); $optout = (bool) get_post_meta($attendee->ID, self::ATTENDEE_OPTOUT_KEY, true); $status = get_post_meta($attendee->ID, self::ATTENDEE_RSVP_KEY, true); $status_label = Tribe__Tickets__Tickets_View::instance()->get_rsvp_options($status); $user_id = get_post_meta($attendee->ID, self::ATTENDEE_USER_ID, true); $ticket_sent = (bool) get_post_meta($attendee->ID, self::ATTENDEE_TICKET_SENT, true); if (empty($product_id)) { continue; } $product = get_post($product_id); $product_title = !empty($product) ? $product->post_title : get_post_meta($attendee->ID, $this->deleted_product, true) . ' ' . __('(deleted)', 'event-tickets'); $attendee_data = array_merge($this->get_order_data($attendee->ID), array('optout' => $optout, 'ticket' => $product_title, 'attendee_id' => $attendee->ID, 'security' => $security, 'product_id' => $product_id, 'check_in' => $checkin, 'order_status' => $status, 'order_status_label' => $status_label, 'user_id' => $user_id, 'ticket_sent' => $ticket_sent)); /** * Allow users to filter the Attendee Data * * @var array An associative array with the Information of the Attendee * @var string What Provider is been used * @var WP_Post Attendee Object * @var int Event ID * */ $attendee_data = apply_filters('tribe_tickets_attendee_data', $attendee_data, 'rsvp', $attendee, $event_id); $attendees[] = $attendee_data; } return $attendees; }
/** * 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')); }
</td> <td colspan="3"> <input type="email" name="attendee[email]" id="tribe-tickets-email"> </td> </tr> <tr class="tribe-tickets-order_status-row"> <td> <label for="tribe-tickets-order_status"><?php echo esc_html_x('RSVP', 'order status label', 'event-tickets'); ?> :</label> </td> <td colspan="3"> <?php Tribe__Tickets__Tickets_View::instance()->render_rsvp_selector('attendee[order_status]', ''); ?> </td> </tr> <?php if (class_exists('Tribe__Tickets_Plus__Attendees_List') && !Tribe__Tickets_Plus__Attendees_List::is_hidden_on(get_the_ID())) { ?> <tr class="tribe-tickets-attendees-list-optout"> <td colspan="4"> <input type="checkbox" name="attendee[optout]" id="tribe-tickets-attendees-list-optout"> <label for="tribe-tickets-attendees-list-optout"><?php esc_html_e('Don\'t list me on the public attendee list', 'event-tickets'); ?> </label> </td>