Event_Meta::attach_rest_properties( TribeEventsVirtualMeetingsZoomarray $data, WP_Post $event )

Add information about the Zoom meeting if available, only if the user has permission to read_private_posts via the REST Api.


Parameters

$data

(<span class="TribeEventsVirtualMeetingsZoomarray">TribeEventsVirtualMeetingsZoomarray) (Required) The current data of the event.

$event

(WP_Post) (Required) The event being updated.


Top ↑

Return

(TribeEventsVirtualMeetingsZoomarray<string,mixed>) An array with the data of the event on the endpoint.


Top ↑

Source

File: src/Tribe/Meetings/Zoom/Event_Meta.php

	public function attach_rest_properties( array $data, \WP_Post $event ) {
		$event = tribe_get_event( $event );

		if ( ! $event instanceof \WP_Post || ! current_user_can( 'read_private_posts' ) ) {
			return $data;
		}

		// Return when Zoom is not the source.
		if ( static::$key_zoom_source_id !== $event->virtual_video_source ) {
			return $data;
		}

		if ( empty( $data['meetings'] ) ) {
			$data['meetings'] = [];
		}

		if ( ! $event->virtual || empty( $event->zoom_meeting_id ) ) {
			return $data;
		}

		$data['meetings']['zoom'] = [
			'id'           => $event->zoom_meeting_id,
			'url'          => $event->zoom_join_url,
			'numbers'      => $event->zoom_global_dial_in_numbers,
			'password'     => get_post_meta( $event->ID, Virtual_Event_Meta::$prefix . 'zoom_password', true ),
			'type'         => $event->zoom_meeting_type,
			'instructions' => $event->zoom_join_instructions,
		];

		return $data;
	}

Top ↑

Changelog

Changelog
Version Description
1.1.1 Introduced.