Zoom_Provider::on_post_save( int $post_id, WP_Post $unused_post, bool $update )
Handles updating Zoom meetings on post save.
Contents
Parameters
- $post_id
-
(int) (Required) The post ID.
- $unused_post
-
(WP_Post) (Required) The post object.
- $update
-
(bool) (Required) Whether this is an existing post being updated or not.
Source
File: src/Tribe/Meetings/Zoom_Provider.php
public function on_post_save( $post_id, $unused_post, $update ) {
if ( ! $update ) {
return;
}
$event = tribe_get_event( $post_id );
if ( ! $event instanceof \WP_Post || empty( $event->duration ) ) {
// Hook for the Event meta save to try later in the save request, data might be there then.
if ( ! doing_action( 'tribe_events_update_meta' ) ) {
// But do no re-hook if we're acting on it.
add_action( 'tribe_events_update_meta', [ $this, 'on_post_save' ], 100, 3 );
}
return;
}
// Handle the update with the correct handler, depending on the meeting type.
if ( empty( $event->zoom_meeting_type ) || Webinars::$meeting_type !== $event->zoom_meeting_type ) {
$meeting_handler = $this->container->make( Meetings::class );
} else {
$meeting_handler = $this->container->make( Webinars::class );
}
$meeting_handler->update( $event );
}
Changelog
| Version | Description |
|---|---|
| 1.0.2 | Introduced. |