ANON_CF7_SUBFORM::wpcf7_submit( $form,  $result )

Validation function when the trigger action is hit


Parameters Parameters

$form

(Required)

$result

(Required)


Source Source

File: src/integrations/contact-form7/triggers/anon-cf7-subform.php

	public function wpcf7_submit( $form, $result ) {
		if ( 'validation_failed' === (string) $result['status'] ) {
			return;
		}
		$args = [
			'code'    => $this->trigger_code,
			'meta'    => $this->trigger_meta,
			'post_id' => $form->id(),
			'user_id' => 0,
		];

		$args = Automator()->process->user->maybe_add_trigger_entry( $args, false );

		//Adding an action to save contact form submission in trigger meta
		$recipes = Automator()->get->recipes_from_trigger_code( $this->trigger_code );
		do_action( 'automator_save_anon_cf7_form', $form, $recipes, $args );

		if ( $args ) {
			foreach ( $args as $result ) {
				if ( true === $result['result'] ) {
					Automator()->process->user->maybe_trigger_complete( $result['args'] );
				}
			}
		}
	}