Tribe__Events__Community__Event_Form::set_event( $event )

sets the event for the form


Source

File: src/Tribe/Event_Form.php

	public function set_event( $event ) {
		if ( ! $event ) {
			return;
		}//end if

		$this->event = $event;

		if ( isset( $event->ID ) ) {
			$this->event_id = $event->ID;
		} elseif ( is_user_logged_in() ) {
			// if the event doesn't exist and the user is authenticated, create an auto draft event
			$this->event_id = wp_insert_post( array( 'post_title' => _x( 'Auto Draft', 'Tribe Community Events fallback post title', 'tribe-events-community' ), 'post_type' => Tribe__Events__Main::POSTTYPE, 'post_status' => 'auto-draft' ) );
			$this->event = get_post( $this->event_id );
		}
	}