function _campaignmonitor_remove_subscriber in Campaign Monitor 6.3
Same name and namespace in other branches
- 5.2 campaignmonitor.module \_campaignmonitor_remove_subscriber()
- 5 campaignmonitor.module \_campaignmonitor_remove_subscriber()
- 6 campaignmonitor.module \_campaignmonitor_remove_subscriber()
- 6.2 campaignmonitor.module \_campaignmonitor_remove_subscriber()
Remove user form a newsletter list identified by e-mail and list ID.
Parameters
string $api_key:
string $list_id:
string $email:
boolean $show_errors:
Return value
boolean, TRUE if subscription removel succeeded else FALSE.
2 calls to _campaignmonitor_remove_subscriber()
- campaignmonitor_subscribe_form_submit in ./
campaignmonitor.module - campaignmonitor_user_page_form_submit in includes/
campaignmonitor.user_page.inc - Implementation of user page form submit.
File
- ./
campaignmonitor.module, line 640 - Module that plugs in Campaign Monitor functionality to your Drupal web site. For Campaign Monitor information see: http://www.campaignmonitor.com/
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 (empty($result) || $result['Result']['Code'] == 0) {
$details = _campaignmonitor_get_list_detail($api_key, $list_id);
drupal_set_message(str_replace('%list', $details['Title'], CM_UNSUBSCRIPTION_SUCCESS), 'status');
return TRUE;
}
else {
if (empty($result)) {
watchdog('campaignmonitor', 'There was a problem with the connection to Campaign Monitor.');
}
else {
watchdog('campaignmonitor', 'Code - %code, Message - %message', array(
'%code' => $result['anyType']['Code'],
'%message' => $result['anyType']['Message'],
));
}
drupal_set_message(CM_UNSUBSCRIPTION_ERROR, 'error', FALSE);
return FALSE;
}
}