public function CampaignMonitorManager::unsubscribe in Campaign Monitor 8.2
Unsubscribe a given user, identified by e-mail address, from a given list.
Parameters
string $listId: 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
- src/
CampaignMonitorManager.php, line 1031
Class
- CampaignMonitorManager
- Manager for Campaignmonitor.
Namespace
Drupal\campaignmonitorCode
public function unsubscribe($listId, $email) {
if ($obj = $this
->createSubscriberObj($listId)) {
$result = $obj
->unsubscribe($email);
if (!$result
->was_successful()) {
$this
->addError($result->response->Message, $result->http_status_code);
return FALSE;
}
$this
->removeSubscriberFromCache($listId, $email);
return TRUE;
}
return FALSE;
}