Description
Allows the draft submission for Save and Continue to be overridden before saved to the database.
Usage
1 | add_filter( 'gform_incomplete_submission_pre_save' , 'your_function_name' , 10, 3 ); |
Parameters
- $submission_json array
JSON encoded associative array containing the incomplete submission. The following is found in the array:
123456* @type
array
$submitted_values
The submitted values.
* @type
array
$partial_entry
The draft entry created from the submitted values.
* @type null|
array
$field_values
The dynamic population field values.
* @type int
$page_number
The forms current page number.
* @type
array
$files
The uploaded file properties.
* @type string
$gform_unique_id
The unique id
for
this submission.
-
$resume_token string
The unique token which can be used to resume the incomplete submission at a later date/time.
-
$form Form Object
The form object.
Examples
1 2 3 4 5 6 7 8 | add_filter( 'gform_incomplete_submission_pre_save' , 'modify_incomplete_submission' , 10, 3 ); function modify_incomplete_submission( $submission_json , $resume_token , $form ){ //change the user first name to Test in the saved data $updated_json = json_decode( $submission_json ); $updated_json ->submitted_values->{ '1' }->{ '1.3' } = 'Test' ; $submission_json = json_encode( $updated_json ); return $submission_json ; } |
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 2.3.4.
Source Code
This filter is located in GFFormsModel::filter_draft_submission_pre_save() in forms_model.php.