You are here

public function CampaignMonitor::isSubscribed in Campaign Monitor 8

Check if a given user, identified by e-mail address, is subscribed to a given list.

Parameters

string $listId: The unique Campaign Monitor list ID.

string $email: The user's e-mail address.

Return value

bool TRUE if subscribed, FALSE if not.

File

src/CampaignMonitor.php, line 792
Implementation of the CampaignMonitor class, which is a wrapper class for Campaign Monitor v3 API. It's implemented as a Singleton class and instances are created using the account variables and the static function getConnector(). An example:.

Class

CampaignMonitor

Namespace

Drupal\campaignmonitor

Code

public function isSubscribed($listId, $email) {
  $result = $this
    ->getSubscriber($listId, $email);
  if (!empty($result)) {
    if ($result['State'] == 'Active') {
      return TRUE;
    }
  }
  return FALSE;
}