Tribe__Tickets__Tickets::get_all_event_tickets( int $post_id, string|null $context = null )

Returns all tickets for an event (all providers are queried for this information).


Parameters

$post_id

(int) (Required) ID of parent "event" post

$context

(string|null) (Optional) The context of the request.

Default value: null


Top ↑

Return

(array)


Top ↑

Source

File: src/Tribe/Tickets.php

		public static function get_all_event_tickets( $post_id ) {

			$cache_key = self::$cache_key_prefix . $post_id;
			$cache = new Tribe__Cache();
			$tickets = $cache->get( $cache_key );

			if ( is_array( $tickets ) ) {
				return $tickets;
			}

			$tickets = [];
			$modules = self::modules();

			foreach ( $modules as $class => $module ) {
				$obj              = call_user_func( array( $class, 'get_instance' ) );
				$provider_tickets = $obj->get_tickets( $post_id );
				if ( is_array( $provider_tickets ) ) {
					$tickets[] = $provider_tickets;
				}
			}

			$tickets = empty( $tickets ) ? [] : call_user_func_array( 'array_merge', $tickets );
			$cache->set( $cache_key, $tickets, Tribe__Cache::NO_EXPIRATION );

			return $tickets;
		}

Top ↑

Changelog

Changelog
Version Description
5.8.0 Introduced.