Tribe__Events__Community__Tickets__Main::require_login( int|null $event_id = null )

Redirects if the user is not logged in


Parameters #

$event_id

(int|null) (Optional)

Default value: null


Top ↑

Source #

File: src/Tribe/Main.php

	public function require_login( $event_id = null ) {
		if ( ! is_user_logged_in() ) {
			wp_redirect( tribe_get_events_link() );
			die;
		}

		if ( empty( $event_id ) ) {
			return;
		}

		$event = get_post( $event_id );

		if ( ! empty( $event ) && get_current_user_id() != $event->post_author ) {
			wp_redirect( tribe_get_events_link() );
			die;
		}
	}