public function CampaignMonitor::unsubscribe in Campaign Monitor 7
Unsubscribe a given user, identified by e-mail address, from a given list.
Parameters
string $list_id: The unique Campaign Monitor list ID.
string $email: The e-mail address that identifies the user.
Return value
bool TRUE on success, FALSE otherwise.
File
- lib/
campaignmonitor.class.inc, line 962 - Implementation of the CampaignMonitor class.
Class
- CampaignMonitor
- Implementation of the CampaignMonitor class.
Code
public function unsubscribe($list_id, $email) {
if ($obj = $this
->createSubscriberObj($list_id)) {
$result = $obj
->unsubscribe($email);
if (!$result
->was_successful()) {
$this
->addError(WATCHDOG_ERROR, $result->response->Message, $result->http_status_code);
return FALSE;
}
$this
->removeSubscriberFromCache($list_id, $email);
return TRUE;
}
return FALSE;
}