function mailchimp_get_lists_for_email in Mailchimp 7.4
Same name and namespace in other branches
- 8 mailchimp.module \mailchimp_get_lists_for_email()
- 7.5 mailchimp.module \mailchimp_get_lists_for_email()
- 7.3 mailchimp.module \mailchimp_get_lists_for_email()
- 2.x mailchimp.module \mailchimp_get_lists_for_email()
Wrapper around MailchimpLists->getListsForEmail()`.
Returns all lists a given email address is currently subscribed to.
Parameters
string $email: Email address to search.
Return value
array Campaign structs containing id, web_id, name.
1 call to mailchimp_get_lists_for_email()
- mailchimp_activity_get_all_activity in modules/
mailchimp_activity/ mailchimp_activity.module - Return all activity on all lists for a given email address.
File
- ./
mailchimp.module, line 1262 - Mailchimp module.
Code
function mailchimp_get_lists_for_email($email) {
try {
/* @var \Mailchimp\MailchimpLists $mc_lists */
$mc_lists = mailchimp_get_api_object('MailchimpLists');
if (!$mc_lists) {
throw new MailchimpException('Cannot get lists without Mailchimp API. Check API key has been entered.');
}
$lists = $mc_lists
->getListsForEmail($email);
} catch (Exception $e) {
watchdog('mailchimp', 'An error occurred retreiving lists data for @email. "%message"', array(
'@email' => $email,
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
$lists = array();
}
return $lists;
}