Description
The gform_partialentries_abort_save filter allows you to stop a partial entry from being saved or updated. You can use it to prevent partial entries from being saved under specific conditions during form processing.
Usage
Applies to all forms:
add_filter( 'gform_partialentries_abort_save', 'your_function_name', 10, 4 );
Applies to a specific form. Replace {FORMID} with your Form ID:
add_filter( 'gform_partialentries_abort_save_{FORMID}', 'your_function_name', 10, 4 );
Parameters
| Name | Type | Description |
|---|---|---|
| $abort | bool | Indicates if saving or updating of the partial entry should be aborted. Default is false. |
| $partial_entry | array | The partial entry to be saved or updated. |
| $partial_entry_id | string | The value of the partial_entry_id input. pending on first save, or the UUID of the partial entry being updated. |
| $form | array | The form currently being processed. |
Examples
Abort saving a partial entry based on Gravity Wiz GP Limit Submissions rules
add_filter( 'gform_partialentries_abort_save', function ( $abort ) {
if ( $abort || ! function_exists( 'gp_limit_submissions' ) ) {
return $abort;
}
$perk = gp_limit_submissions();
if ( empty( $perk->enforce ) || empty( $perk->enforce->get_rule_groups() ) ) {
return false;
}
$result = $perk->enforce->get_test_result();
if ( empty( $result ) ) {
return false;
}
gf_partial_entries()->log_debug( 'gform_partialentries_abort_save: gp limit submissions result => ' . print_r( $result, true ) );
return (bool) rgobj( $result, 'fail' );
} );
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?
Since
This filter was added in Partial Entries Add-On v1.8.0
Source
This filter is located in GF_Partial_Entries::maybe_save_partial_entry() in class-gf-partial-entries.php