You are here

function mailchimp_get_marketing_permissions in Mailchimp 8

Same name and namespace in other branches
  1. 7.5 mailchimp.module \mailchimp_get_marketing_permissions()
  2. 2.x mailchimp.module \mailchimp_get_marketing_permissions()

Get the marketing permissions for a subscribed member.

Simple wrapper around mailchimp_get_memberinfo().

Parameters

string $list_id: Unique string identifier for the list on your MailChimp account.

string $email: Email address to check for on the identified MailChimp List.

bool $reset: Set to TRUE to ignore the cache. (Used heavily in testing functions.)

Return value

array An array of marketing permissions, or an empty array if not subscribed

2 calls to mailchimp_get_marketing_permissions()
mailchimp_subscribe_process in ./mailchimp.module
Wrapper around Mailchimp_Lists::subscribe().
mailchimp_update_member_process in ./mailchimp.module
Wrapper around Mailchimp_Lists::updateMember().

File

./mailchimp.module, line 383
Mailchimp module.

Code

function mailchimp_get_marketing_permissions($list_id, $email, $reset = FALSE) {
  $memberinfo = mailchimp_get_memberinfo($list_id, $email, $reset);
  if (isset($memberinfo->status) && $memberinfo->status == 'subscribed' && isset($memberinfo->marketing_permissions)) {
    return $memberinfo->marketing_permissions;
  }
  return [];
}