Tribe__Tickets__Tickets_Handler::update_meta_date( int $meta_id, int $object_id, string $meta_key, string $date )

On update of the event start date we update the ticket end date if it wasn’t manually updated


Parameters

$meta_id

(int) (Required) MID

$object_id

(int) (Required) Which Post we are dealing with

$meta_key

(string) (Required) Which meta key we are fetching

$date

(string) (Required) Value save on the DB


Top ↑

Return

(boolean)


Top ↑

Source

File: src/Tribe/Tickets_Handler.php

	public function update_meta_date( $meta_id, $object_id, $meta_key, $date ) {
		$meta_map = array(
			'_EventEndDate' => $this->key_end_date,
		);

		// Bail when it's not on the Map Meta
		if ( ! isset( $meta_map[ $meta_key ] ) ) {
			return false;
		}

		$event_types = Tribe__Tickets__Main::instance()->post_types();
		$post_type = get_post_type( $object_id );

		// Bail on non event like post type
		if ( ! in_array( $post_type, $event_types ) ) {
			return false;
		}

		$update_meta = $meta_map[ $meta_key ];
		$tickets = $this->get_tickets_ids( $object_id );

		foreach ( $tickets as $ticket ) {
			// Skip tickets with manual updates to that meta
			if ( $this->has_manual_update( $ticket, $update_meta ) ) {
				continue;
			}

			update_post_meta( $ticket, $update_meta, $date );
		}

		return true;
	}

Top ↑

Changelog

Changelog
Version Description
4.6 Introduced.