You are here

public function MailChimpTest::listMemberInfo in Mailchimp 7.2

Get the details of an email address's settings in a particular list.

Return value

array An array that counts the successes and failures, and contains a Data index for the info. Only supports a single operation despite the structure of the success and error indexes.

Overrides MCAPI::listMemberInfo

File

tests/mailchimp_tests.inc, line 17
A virtual MailChimp API implementation for use in testing.

Class

MailChimpTest
@file A virtual MailChimp API implementation for use in testing.

Code

public function listMemberInfo($id, $email_address) {
  $lists = $this
    ->loadLists();
  $ret = array(
    'success' => 0,
    'errors' => 0,
    'data' => array(),
  );
  if (isset($lists[$id]['data'][$email_address[0]])) {
    $member = $lists[$id]['data'][$email_address[0]];
    $ret['success'] = 1;
    $ret['data'][] = array(
      'email' => $email_address[0],
      'email_type' => $member['email_type'],
      'merges' => $member['merge_vars'],
      'status' => $member['subscribed'] ? 'subscribed' : 'unsubscribed',
    );
  }
  else {
    $ret['errors'] = 1;
  }
  return $ret;
}