You are here

function CMBase::checkSubscriptions in Campaign Monitor 5.2

* 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 547

Class

CMBase

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;
}