Description
Triggered after an incomplete form submission is saved.
Usage
add_action( 'gform_incomplete_submission_post_save', 'my_function', 10, 4 );
Parameters
Parameter | Type | Description |
---|---|---|
$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 );
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
This action hook is located in forms_model.php.