Description
This filter can be used to modify the subscriber parameters before they are 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_subscriber', 'your_function_name', 10, 4 );
Parameters
| Parameter | Type | Description |
|---|---|---|
$subscriber | array | An associative array containing all the parameters to be passed to Campaign Monitor. |
$form | Form Object | The Form which is currently being processed. |
$entry | Entry Object | The Entry which is currently being processed. |
$feed | Feed Object | The Feed which is currently being processed. |
Examples
Add the RestartSubscriptionBasedAutoresponders parameter.
This example shows how you can add the RestartSubscriptionBasedAutoresponders parameter to the subscriber array. This will restart the any automated workflows for resubscribed subscribers, more details in Campaign Monitor API docs.
add_filter( 'gform_campaignmonitor_override_subscriber', function ( $subscriber, $entry, $form, $feed ) {
$subscriber['RestartSubscriptionBasedAutoresponders'] = true;
return $subscriber;
}, 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 filter is located in GFCampaignMonitor::export_feed() in class-gf-campaignmonitor.php.