You are here

function hook_campaignmonitor_subscriber_data_alter in Campaign Monitor 7

Allow the alter the subscribers data.

1 invocation of hook_campaignmonitor_subscriber_data_alter()
CampaignMonitor::subscribe in lib/campaignmonitor.class.inc
Subscribe a user to a given list, with information entered.

File

./campaignmonitor.api.php, line 11
API documentation for the Campaign Monitor module.

Code

function hook_campaignmonitor_subscriber_data_alter(&$data, $list_id) {
  $cm = CampaignMonitor::getConnector();
  $subscriber_data = $cm
    ->getSubscriber($list_id, $data['EmailAddress']);
  if (!empty($subscriber_data)) {
    if ($subscriber_data['State'] == 'Active') {
      $cm
        ->unsubscribe($list_id, $data['EmailAddress']);
    }
  }
  $data['RestartSubscriptionBasedAutoResponders'] = TRUE;
}