GTW_UNREGISTERUSER::gtw_unregister_user( $user_id, $action_data, $recipe_id, $args )
Validation function when the action is hit
Contents
Parameters Parameters
- $user_id
-
(Required)
- $action_data
-
(Required)
- $recipe_id
-
(Required)
Source Source
File: src/integrations/gotowebinar/actions/gtw-unregisteruser.php
public function gtw_unregister_user( $user_id, $action_data, $recipe_id, $args ) { try { if ( empty( $user_id ) ) { throw new \Exception( __( 'User not found.', 'uncanny-automator' ) ); } $webinar_key = Automator()->parse->text( $action_data['meta'][ $this->action_meta ], $recipe_id, $user_id, $args ); if ( empty( $webinar_key ) ) { throw new \Exception( __( 'Webinar not found.', 'uncanny-automator' ) ); } $webinar_key = str_replace( '-objectkey', '', $webinar_key ); $user_registrant_key = get_user_meta( $user_id, '_uncannyowl_gtw_webinar_' . $webinar_key . '_registrantKey', true ); if ( empty( $user_registrant_key ) ) { throw new \Exception( __( 'User was not registered for webinar.', 'uncanny-automator' ) ); } $result = Automator()->helpers->recipe->gotowebinar->gtw_unregister_user( $user_id, $webinar_key, $action_data ); Automator()->complete_action( $user_id, $action_data, $recipe_id ); } catch ( \Exception $e ) { $action_data['do-nothing'] = true; $action_data['complete_with_errors'] = true; Automator()->complete_action( $user_id, $action_data, $recipe_id, $e->getMessage() ); } }
Expand full source code Collapse full source code View on Github