Password::update_password_from_zoom( WP_Post $event )
Update the Zoom Password Related Meta Fields
Contents
Parameters
- $event
-
(WP_Post) (Required) The event post object.
Return
(bool|void) Whether the update completed.
Source
File: src/Tribe/Meetings/Zoom/Password.php
public function update_password_from_zoom( $event ) {
$event = tribe_get_event( $event->ID );
if ( ! $event instanceof \WP_Post ) {
return;
}
if ( empty( $event->virtual ) ) {
return;
}
if ( empty( $event->zoom_meeting_id ) ) {
return;
}
$this->api->load_account();
if ( empty( $this->api->is_ready() ) ) {
return;
}
$meeting = $this->api->fetch_meeting_data( $event->zoom_meeting_id, $event->zoom_meeting_type );
if ( empty( $meeting['password'] ) || empty( $meeting['join_url'] ) ) {
return;
}
// It would be nice to have the encrypted password available; should that not be the case let's extract it.
$meeting_encrypted_password = isset( $meeting['encrypted_password'] )
? $meeting['encrypted_password']
: $this->get_hash_pwd_from_join_url( $meeting['join_url'] );
$prefix = Virtual_Event_Meta::$prefix;
update_post_meta( $event->ID, $prefix . 'zoom_password', esc_html( $meeting['password'] ) );
update_post_meta( $event->ID, $prefix . 'zoom_password_hash', esc_html( $meeting_encrypted_password ) );
update_post_meta( $event->ID, $prefix . 'zoom_join_url', esc_url( $meeting['join_url'] ) );
return true;
}
Changelog
| Version | Description |
|---|---|
| 1.0.4 | Introduced. |