You are here

function mailchimp_is_subscribed in Mailchimp 2.x

Same name and namespace in other branches
  1. 8 mailchimp.module \mailchimp_is_subscribed()
  2. 7.5 mailchimp.module \mailchimp_is_subscribed()
  3. 7.2 mailchimp.module \mailchimp_is_subscribed()
  4. 7.3 mailchimp.module \mailchimp_is_subscribed()
  5. 7.4 mailchimp.module \mailchimp_is_subscribed()

Check if the given email is subscribed to the given list.

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

bool TRUE if subscribed, FALSE otherwise.

6 calls to mailchimp_is_subscribed()
MailchimpListsSelectWidget::getSubscribeDefault in modules/mailchimp_lists/src/Plugin/Field/FieldWidget/MailchimpListsSelectWidget.php
MailchimpListsSubscribeDefaultFormatter::viewElements in modules/mailchimp_lists/src/Plugin/Field/FieldFormatter/MailchimpListsSubscribeDefaultFormatter.php
Builds a renderable array for a field value.
MailchimpListsSubscribeForm::buildForm in modules/mailchimp_lists/src/Form/MailchimpListsSubscribeForm.php
Form constructor.
MailchimpListsSubscriptionTest::testIsSubscribed in modules/mailchimp_lists/tests/src/Functional/MailchimpListsSubscriptionTest.php
Tests the status of a member's subscription to a list.
mailchimp_lists_process_subscribe_form_choices in modules/mailchimp_lists/mailchimp_lists.module
Processor for various list form submissions.

... See full list

File

./mailchimp.module, line 367
Mailchimp module.

Code

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