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/cf7-subform.php

	public function wpcf7_submit( $form, $result ) {
		if ( 'validation_failed' !== $result['status'] ) {

			$user_id = wp_get_current_user()->ID;

			$args = [
				'code'    => $this->trigger_code,
				'meta'    => $this->trigger_meta,
				'post_id' => $form->id(),
				'user_id' => $user_id,
			];

			$args = Automator()->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_cf7_form', $form, $recipes, $args );

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