Description
The filter gform_activecampaign_override_empty_fields
can be used to prevent empty form fields from erasing values already stored in Active Campaign when updating an existing subscriber.
Usage
Applies to all forms.
add_filter( 'gform_activecampaign_override_empty_fields', 'your_function_name' );
You can also specify this per form by adding the form id after the hook name.
add_filter( 'gform_activecampaign_override_empty_fields_14', 'your_function_name' );
Parameters
- $override bool
Indicates if blank fields should override values already stored in Active Campaign. The default is true. - $form Form Object
The form object. - $entry Entry Object
The current entry. - $feed Feed Object
The feed object.
Examples
1. Prevent overwriting data in Active Campaign across all forms
This example would prevent overwriting of data in Active Campaign when empty field values are processed.
add_filter( 'gform_activecampaign_override_empty_fields', '__return_false' );
2. Prevent overwriting data in Active Campaign for a specific feed
This example would prevent overwriting of data in Active Campaign when processing a specific feed.
add_filter( 'gform_activecampaign_override_empty_fields', function( $override, $form, $entry, $feed ) {
if ( rgar( $feed, 'id' ) === 117 ) {
return false;
}
return $override;
}, 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?
Since
This filter was added in Gravity Forms ActiveCampaign v1.5.
Source Code
This filter is located in class-gf-activecampaign.php.