Using Gravity Forms ‘gform_campaignmonitor_override_subscriber’ PHP filter

The gform_campaignmonitor_override_subscriber filter allows you to modify the subscriber parameters before they are sent to Campaign Monitor.

Usage

To use the filter for all Campaign Monitor feeds, add the following line of code:

add_filter('gform_campaignmonitor_override_subscriber', 'your_function_name', 10, 4);

Parameters

  • $subscriber (array): An associative array containing all the parameters to be passed to Campaign Monitor.
  • $form (Form Object): The form currently being processed.
  • $entry (Entry Object): The entry currently being processed.
  • $feed (Feed Object): The feed currently being processed.

More information

See Gravity Forms Docs: gform_campaignmonitor_override_subscriber

Examples

Add RestartSubscriptionBasedAutoresponders parameter

This example demonstrates how to add the RestartSubscriptionBasedAutoresponders parameter to the subscriber array. This will restart any automated workflows for resubscribed subscribers. More details can be found in the Campaign Monitor API docs.

add_filter('gform_campaignmonitor_override_subscriber', function ($subscriber, $entry, $form, $feed) {
    $subscriber['RestartSubscriptionBasedAutoresponders'] = true;
    return $subscriber;
}, 10, 4);

Placement Place your code snippet in the functions.php file of your active theme.

Source Code

apply_filters('gform_campaignmonitor_override_subscriber', $subscriber, $entry, $form, $feed)

This filter is located in GFCampaignMonitor::export_feed() in class-gf-campaignmonitor.php.