Description
This filter can be used to modify how the add-on handles blank custom fields. The default behaviour is to remove custom fields which don’t have a value from the CustomFields array so they aren’t sent to Campaign Monitor.
Usage
The filter which would run for all Campaign Monitor feeds can be used like so:
add_filter( 'gform_campaignmonitor_override_blank_custom_fields', 'your_function_name', 10, 4 );
Parameters
- $override boolean
The default is false.
-
$entry Entry Object
The Entry which is currently being processed.
-
$form Form Object
The Form which is currently being processed.
-
$feed Feed Object
The Feed which is currently being processed.
Examples
1. Override all feeds
The following example shows how you can apply the filter to all Campaign Monitor feeds.
add_filter( 'gform_campaignmonitor_override_blank_custom_fields', '__return_true' );
2. Override specific feed
The following example shows how you can target a specific Campaign Monitor feed.
add_filter( 'gform_campaignmonitor_override_blank_custom_fields', function ( $override, $entry, $form, $feed ) { $feed_name = rgars( $feed, 'meta/feedName' ); return $feed_name == 'Your feed name' ? true : false; }, 10, 4 );
Placement
Your code snippet should be placed in the functions.php file of your active theme.
Source Code
apply_filters( 'gform_campaignmonitor_override_blank_custom_fields', false, $entry, $form, $feed )
This filter is located in GFCampaignMonitor::export_feed() in class-gf-campaignmonitor.php.