You are here

function CampaignMonitor::checkSubscriptions in Campaign Monitor 6.2

Same name and namespace in other branches
  1. 6.3 lib/CMBase.php \CampaignMonitor::checkSubscriptions()

* Given an array of lists, indicate whether the $email is subscribed to each of those lists. * *

Parameters

string $email User's email: * @param mixed $lists An associative array of lists to check against. Each key should be a List ID * @param boolean $no_assoc If true, only returns an array where each value indicates that the user is subscribed * to that particular list. Otherwise, returns a fully associative array of $list_id => true | false. * @return mixed An array corresponding to $lists where true means the user is subscribed to that particular list.

File

lib/CMBase.php, line 773

Class

CampaignMonitor
The new CampaignMonitor class that now extends from CMBase. This should be backwards compatible with the original (PHP5) version.

Code

function checkSubscriptions($email, $lists, $no_assoc = true) {
  $nlist = array();
  foreach ($lists as $lid => $misc) {
    $val = $this
      ->subscribersGetIsSubscribed($email, $lid);
    $val = $val != 'False';
    if ($no_assoc && $val) {
      $nlist[] = $lid;
    }
    elseif (!$no_assoc) {
      $nlist[$lid] = $val;
    }
  }
  return $nlist;
}