Tribe__Tickets__Tickets::get_attendee_optout_key( self|string $provider )

Given a ticket provider, get its Attendee Optout Meta Key from its class property (or constant if legacy).


Parameters #

$provider

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


Top ↑

Return #

(string) The meta key or an empty string if passed an invalid or inactive ticket provider.


Top ↑

Source #

File: src/Tribe/Tickets.php

		public static function get_attendee_optout_key( $provider ) {
			$provider = static::get_ticket_provider_instance( $provider );

			if ( empty( $provider ) ) {
				return '';
			}

			/**
			 * Not all classes have this static method.
			 *
			 * @see \Tribe__Tickets__Commerce__PayPal__Main::get_key() Does have this static method.
			 */
			if ( method_exists( $provider, 'get_key' ) ) {
				$key = $provider::get_key( 'attendee_optout_key' );
			}

			if ( ! empty( $key ) ) {
				return $key;
			}

			if ( ! empty( $provider->attendee_optout_key ) ) {
				return $provider->attendee_optout_key;
			}

			$key = constant( "{$provider->class_name}::ATTENDEE_OPTOUT_KEY" );

			return (string) $key;
		}

Top ↑

Changelog #

Changelog
Version Description
4.12.3 Introduced.