/**
  * Update the RSVP and Tickets values for each Attendee
  */
 public function update_tickets()
 {
     $is_correct_page = get_query_var('tribe-edit-orders', false);
     // Now fetch the display and check it
     $display = get_query_var('eventDisplay', false);
     if ('tickets' !== $display && !$is_correct_page) {
         return;
     }
     if (empty($_POST['process-tickets']) || empty($_POST['attendee']) && empty($_POST['tribe-tickets-meta'])) {
         return;
     }
     $post_id = get_the_ID();
     $attendees = !empty($_POST['attendee']) ? $_POST['attendee'] : array();
     foreach ($attendees as $order_id => $data) {
         /**
          * An Action fired for each one of the Attendees that were posted on the Order Tickets page
          *
          * @var $data     Infomation that we are trying to save
          * @var $order_id ID of attendee ticket
          * @var $post_id  ID of event
          */
         do_action('event_tickets_attendee_update', $data, $order_id, $post_id);
     }
     /**
      * A way for Meta to be saved, because it's grouped in a different way
      *
      * @var $post_id ID of event
      */
     do_action('event_tickets_after_attendees_update', $post_id);
     // After Editing the Values we Update the Transient
     Tribe__Post_Transient::instance()->delete($post_id, Tribe__Tickets__Tickets::ATTENDEES_CACHE);
     // If it's not events CPT
     if ($is_correct_page) {
         $url = home_url('tickets/') . $post_id;
     } else {
         $url = get_permalink($post_id) . '/tickets';
     }
     $url = add_query_arg('tribe_updated', 1, $url);
     wp_safe_redirect(esc_url_raw($url));
     exit;
 }
Beispiel #2
0
 /**
  * Remove the Post Transients for the Tickets Attendees
  *
  * @param  int $attendee_id
  * @param  int $event_id
  * @param  int $product_id
  * @return void
  */
 public function purge_transient($attendee_id, $event_id, $product_id)
 {
     Tribe__Post_Transient::instance()->delete($event_id, Tribe__Tickets__Tickets::ATTENDEES_CACHE);
 }
 /**
  * @param $operation_did_complete
  */
 private function maybe_update_attendees_cache($operation_did_complete)
 {
     if ($operation_did_complete && !empty($_POST['event_ID'])) {
         $post_transient = Tribe__Post_Transient::instance();
         $post_transient->delete($_POST['event_ID'], self::ATTENDEES_CACHE);
     }
 }
 /**
  * Returns all the attendees for an event. Queries all registered providers.
  *
  * @static
  *
  * @param $event_id
  *
  * @return array
  */
 public static function get_event_attendees($event_id)
 {
     $attendees = array();
     if (!is_admin()) {
         $post_transient = Tribe__Post_Transient::instance();
         $attendees = $post_transient->get($event_id, self::ATTENDEES_CACHE);
         if (!$attendees) {
             $attendees = array();
         }
         if (is_array($attendees) && count($attendees) > 0) {
             return $attendees;
         }
     }
     foreach (self::$active_modules as $class => $module) {
         $obj = call_user_func(array($class, 'get_instance'));
         $attendees = array_merge($attendees, $obj->get_attendees($event_id));
     }
     if (!is_admin()) {
         $expire = apply_filters('tribe_tickets_attendees_expire', HOUR_IN_SECONDS);
         $post_transient->set($event_id, self::ATTENDEES_CACHE, $attendees, $expire);
     }
     return $attendees;
 }
 /**
  * Indicates if the queue for the current event is actively being processed.
  *
  * @return bool
  */
 public function is_in_progress()
 {
     Tribe__Post_Transient::instance()->get($this->record->id, self::$in_progress_key);
 }
Beispiel #6
0
 /**
  * Remove the Post Transients when a Shopp Ticket is bought
  *
  * @param  int $attendee_id
  * @return void
  */
 public function purge_attendees_transient($attendee_id)
 {
     $event_id = get_post_meta($attendee_id, self::ATTENDEE_EVENT_KEY, true);
     Tribe__Post_Transient::instance()->delete($event_id, Tribe__Tickets__Tickets::ATTENDEES_CACHE);
 }
 /**
  * Deletes the attendees caches for a post.
  *
  * @param int $post_id The post `ID` field.
  */
 public static function delete_attendees_caches($post_id)
 {
     $post_transient = Tribe__Post_Transient::instance();
     $post_transient->delete($post_id, Tribe__Tickets__Tickets::ATTENDEES_CACHE);
 }