tribe_tickets_is_provider_active( Tribe__Tickets__Tickets|string $provider )

Whether the passed ticket provider class string (or its slug) is active.

Example: if provider is for a WooCommerce Ticket but ETP is disabled, returns False.


Parameters #

$provider

(Tribe__Tickets__Tickets|string) (Required) Examples: 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main', 'woo', 'rsvp', etc.


Top ↑

Return #

(bool) True if class exists and is in the list of active modules.


Top ↑

Source #

File: src/template-tags/tickets.php

	function tribe_tickets_is_provider_active( $provider ) {
		if ( $provider instanceof Tribe__Tickets__Tickets ) {
			$provider = $provider->class_name;
		}

		// Protect against other type of object or other unexpected value.
		if ( ! is_string( $provider ) ) {
			return false;
		}

		/** @var Tribe__Tickets__Status__Manager $status */
		$status = tribe( 'tickets.status' );

		$provider = $status->get_provider_class_from_slug( $provider );

		return (
			class_exists( $provider )
			&& array_key_exists( $provider, Tribe__Tickets__Tickets::modules() )
		);
	}

Top ↑

Changelog #

Changelog
Version Description
4.12.3 Introduced.