Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Fr_Tokens::fr_save_form_entry( $form_id,  $recipes,  $args )

Save form entry in meta.


Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Parameters Parameters

$form_id

(Required)

$recipes

(Required)

$args

(Required)


Top ↑

Return Return

(null|string)


Source Source

File: src/integrations/forminator/tokens/fr-tokens.php

	public function fr_save_form_entry( $form_id, $recipes, $args ) {
		if ( is_array( $args ) ) {
			foreach ( $args as $trigger_result ) {
				if ( true === $trigger_result['result'] ) {
					if ( $recipes && absint( $form_id ) > 0 ) {
						foreach ( $recipes as $recipe ) {
							$triggers = $recipe['triggers'];
							if ( $triggers ) {
								foreach ( $triggers as $trigger ) {
									$trigger_id = $trigger['ID'];
									if ( ! key_exists( 'FRFORM', $trigger['meta'] ) ) {
										continue;
									} else {
										// Only form entry id will be saved.
										$form_entry        = forminator_get_latest_entry_by_form_id( $form_id );
										$data              = $form_entry->entry_id;
										$user_id           = (int) $trigger_result['args']['user_id'];
										$recipe_log_id_raw = isset( $trigger_result['args']['recipe_log_id'] ) ? (int) $trigger_result['args']['recipe_log_id'] : Automator()->maybe_create_recipe_log_entry( $recipe['ID'], $user_id );
										if ( $recipe_log_id_raw ) {
											$trigger_log_id = (int) $trigger_result['args']['get_trigger_id'];
											$run_number     = (int) $trigger_result['args']['run_number'];
											$args           = [
												'user_id'        => $user_id,
												'trigger_id'     => $trigger_id,
												'meta_key'       => 'FRFORM_' . $form_id,
												'meta_value'     => $data,
												'run_number'     => $run_number, //get run number
												'trigger_log_id' => $trigger_log_id,
											];
											Automator()->insert_trigger_meta( $args );
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}