gform_incomplete_submission_post_save

gform_incomplete_submission_post_save

DescriptionUsageParametersExamples1. Basic usage2. Trigger Mailchimp feed3. Save token to current userSource Code

Description
Triggered after an incomplete form submission is saved.
Usage
add_action( 'gform_incomplete_submission_post_save', 'my_function', 10, 4 );

Parameters

$submission array
The submission data that was submitted.

$resume_token string
Resume token that is being used for this partial entry.

$form array
Contains an array of information regarding the form.

$entry array
Contains the partial entry that was created.

Examples
1. Basic usage
function my_function($submission, $resume_token, $form, $entry) {
//Do something here
}
add_action( 'gform_incomplete_submission_post_save', 'my_function', 10, 4 );

2. Trigger Mailchimp feed
This example shows how you can trigger the processing of a specific feed when an incomplete submission is saved.
add_action( 'gform_incomplete_submission_post_save', function ( $submission, $resume_token, $form, $entry ) {
if ( function_exists( 'gf_mailchimp' ) ) {
$feed = gf_mailchimp()->get_feed( '40' );
if ( ! empty( $feed ) ) {
gf_mailchimp()->process_feed( $feed, $entry, $form );
}
}
}, 10, 4 );

3. Save token to current user
This example shows how you can the resume token to the currently logged in users profile when an incomplete submission is saved.
add_action( 'gform_incomplete_submission_post_save', function ( $submission, $resume_token, $form, $entry ) {
if ( is_user_logged_in () ) {
update_user_meta( get_current_user_id(), '_gf_resume_token', $resume_token );
}
}, 10, 4 );

Source Code
This action hook is located in forms_model.php.

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註