ANON_ELEM_SUBMITFORM::elem_submit_form( object $record, object $object )
Validation function when the trigger action is hit
Contents
Parameters Parameters
- $record
-
(Required)
- $object
-
(Required)
Source Source
File: src/integrations/elementor/triggers/anon-elem-submitform.php
public function elem_submit_form( $record, $object ) { if ( ! $object->is_success ) { return; } $form_id = $record->get_form_settings( 'id' ); if ( empty( $form_id ) ) { return; } $user_id = get_current_user_id(); $recipes = Automator()->get->recipes_from_trigger_code( $this->trigger_code ); $conditions = $this->match_condition( $form_id, $recipes, $this->trigger_meta, $this->trigger_code ); if ( ! $conditions ) { return; } foreach ( $conditions['recipe_ids'] as $trigger_id => $recipe_id ) { if ( Automator()->is_recipe_completed( $recipe_id, $user_id ) ) { continue; } $args = [ 'code' => $this->trigger_code, 'meta' => $this->trigger_meta, 'recipe_to_match' => $recipe_id, 'trigger_to_match' => $trigger_id, 'ignore_post_id' => true, 'user_id' => $user_id, ]; $args = Automator()->process->user->maybe_add_trigger_entry( $args, false ); do_action( 'automator_save_elementor_form_entry', $record, $recipes, $args ); if ( $args ) { foreach ( $args as $result ) { if ( true === $result['result'] ) { Automator()->process->user->maybe_trigger_complete( $result['args'] ); } } } } }
Expand full source code Collapse full source code View on Github