You are here

function _campaignmonitor_remove_subscriber in Campaign Monitor 5.2

Same name and namespace in other branches
  1. 5 campaignmonitor.module \_campaignmonitor_remove_subscriber()
  2. 6.3 campaignmonitor.module \_campaignmonitor_remove_subscriber()
  3. 6 campaignmonitor.module \_campaignmonitor_remove_subscriber()
  4. 6.2 campaignmonitor.module \_campaignmonitor_remove_subscriber()
2 calls to _campaignmonitor_remove_subscriber()
campaignmonitor_general_form_submit in ./campaignmonitor.module
campaignmonitor_user_form_submit in ./campaignmonitor.module

File

./campaignmonitor.module, line 421

Code

function _campaignmonitor_remove_subscriber($api_key, $list_id, $email, $show_errors = FALSE) {
  $cm = new CampaignMonitor($api_key, $client_id, $campaign_id, $list_id);
  $result = $cm
    ->subscriberUnsubscribe($email);
  if ($result['Result']['Code'] == 0) {
    drupal_set_message("You have successfully been unsubscribed.", 'status');
  }
  else {
    watchdog('campaignmonitor', 'Code - ' . $result['anyType']['Code'] . ', Message - ' . $result['anyType']['Message'], WATCHDOG_ERROR);
    drupal_set_message("There was an error unsubscribing from newsletter.", 'error');
  }
}