Zoom_Helpers::unregister_user( $email, string $meeting_key,  $action_data )

For un-registering user to meeting action method.


Parameters Parameters

$user_id

(Required)

$meeting_key

(Required)


Top ↑

Return Return

(array)


Source Source

File: src/integrations/zoom/helpers/zoom-helpers.php

	public function unregister_user( $email, $meeting_key ) {
		$client = $this->get_client();
		if ( ! $client || empty( $client['access_token'] ) ) {
			return array(
				'result'  => false,
				'message' => __( 'Zoom credentails have expired.', 'uncanny-automator' ),
			);
		}
		$response = wp_remote_post(
			$this->automator_api,
			array(
				'body' =>
					array(
						'action'       => 'unregister_meeting_user',
						'access_token' => $client['access_token'],
						'meeting_key'  => $meeting_key,
						'email'        => $email,
					),
			)
		);
		if ( ! is_wp_error( $response ) ) {
			if ( 201 === wp_remote_retrieve_response_code( $response ) || 204 === wp_remote_retrieve_response_code( $response ) ) {
				return array(
					'result'  => true,
					'message' => __( 'Successfully unregistered', 'uncanny-automator' ),
				);
			} else {
				$body = json_decode( wp_remote_retrieve_body( $response ), true );
				$error = '';
				if ( isset( $body['data']['message'] ) ) {
					$error = $body['data']['message'];
				} elseif ( isset( $body['error']['description'] ) ) {
					$error = $body['error']['description'];
				}
				return array(
					'result'  => false,
					'message' => __( $error, 'uncanny-automator' ),
				);
			}
		}
		return array(
			'result'  => false,
			'message' => __( 'WordPress was not able to communicate with Zoom API.', 'uncanny-automator' ),
		);
	}