Tribe__Events__Community__Tickets__Main::is_enabled_for_event( mixed $event )

Returns whether or not tickets are enabled for a given event


Parameters #

$event

(mixed) (Required) WP_Post or ID for event


Top ↑

Return #

(boolean)


Top ↑

Source #

File: src/Tribe/Main.php

	public function is_enabled_for_event( $event ) {
		// If split payments are not enabled, we don't need to worry about the creator's paypal email address
		if ( ! $this->is_split_payments_enabled() ) {
			return true;
		}

		if ( ! $event ) {
			// If an event isn't passed in, assume we're creating an event and use the currently logged in user
			$user_id = get_current_user_id();
		} else {
			if ( ! $event instanceof WP_Post ) {
				if ( ! is_numeric( $event ) ) {
					return false;
				}

				$event = get_post( $event );
			}

			if ( ! $event ) {
				return false;
			}

			$user_id = $event->post_author;
		}

		$user_meta = $this->payment_options_form()->get_meta( $user_id );

		return filter_var( $user_meta['paypal_account_email'], FILTER_VALIDATE_EMAIL );
	}