ZOOM_WEBINAR_REGISTERUSER::zoom_webinar_register_user( $user_id,  $action_data,  $recipe_id,  $args )

Validation function when the action is hit


Parameters Parameters

$user_id

(Required)

$action_data

(Required)

$recipe_id

(Required)


Source Source

File: src/integrations/zoom-webinar/actions/zoom-webinar-registeruser.php

	public function zoom_webinar_register_user( $user_id, $action_data, $recipe_id, $args ) {

		$webinar_key = Automator()->parse->text( $action_data['meta'][ $this->action_meta ], $recipe_id, $user_id, $args );

		if ( empty( $user_id ) ) {
			$error_msg                           = __( 'User not found.', 'uncanny-automator' );
			$action_data['do-nothing']           = true;
			$action_data['complete_with_errors'] = true;
			Automator()->complete_action( $user_id, $action_data, $recipe_id, $error_msg );

			return;
		}

		if ( empty( $webinar_key ) ) {
			$error_msg                           = __( 'Webinar not found.', 'uncanny-automator' );
			$action_data['do-nothing']           = true;
			$action_data['complete_with_errors'] = true;
			Automator()->complete_action( $user_id, $action_data, $recipe_id, $error_msg );

			return;
		}

		if ( ! empty( $webinar_key ) ) {
			$webinar_key = str_replace( '-objectkey', '', $webinar_key );
		}

		$result = Automator()->helpers->recipe->zoom_webinar->register_user( $user_id, $webinar_key );

		if ( ! $result['result'] ) {
			$error_msg                           = $result['message'];
			$action_data['do-nothing']           = true;
			$action_data['complete_with_errors'] = true;
			Automator()->complete_action( $user_id, $action_data, $recipe_id, $error_msg );

			return;
		}

		Automator()->complete_action( $user_id, $action_data, $recipe_id );

	}