CF_SUBFORM::caldera_forms_submit( $form,  $referrer,  $process_id,  $entryid )

Validation function when the trigger action is hit


Parameters Parameters

$form

(Required)

$referrer

(Required)


Source Source

File: src/integrations/caldera-forms/triggers/cf-subform.php

	public function caldera_forms_submit( $form, $referrer, $process_id, $entryid ) {


		$user_id    = wp_get_current_user()->ID;
		$recipes    = Automator()->get->recipes_from_trigger_code( $this->trigger_code );
		$conditions = $this->match_condition( $form, $recipes, $this->trigger_meta, $this->trigger_code );

		if ( ! $conditions ) {
			return;
		}

		if ( ! empty( $conditions ) ) {
			foreach ( $conditions['recipe_ids'] as $recipe_id ) {
				if ( ! Automator()->is_recipe_completed( $recipe_id, $user_id ) ) {
					$args = [
						'code'            => $this->trigger_code,
						'meta'            => $this->trigger_meta,
						'recipe_to_match' => $recipe_id,
						'ignore_post_id'  => true,
						'user_id'         => $user_id,
					];

					Automator()->maybe_add_trigger_entry( $args );
				}
			}
		}
	}