You are here

function mailchimp_unsubscribe_member in Mailchimp 7.4

Same name and namespace in other branches
  1. 7.5 mailchimp.module \mailchimp_unsubscribe_member()

Unsubscribe a member from a list.

Parameters

string $list_id: A mailchimp list id.

string $email: Email address to be unsubscribed.

bool $delete: Indicates whether an email should be deleted or just unsubscribed.

bool $goodbye: Indicates whether to send the goodbye email to the email address.

bool $notify: Indicates whether to send the unsubscribe notification email to the address defined in the list email notification settings.

Return value

bool Indicates whether unsubscribe was successful.

2 calls to mailchimp_unsubscribe_member()
MailchimpListsTestCase::testUnsubscribe in modules/mailchimp_lists/tests/mailchimp_lists.test
Tests unsubscribing a member from a list.
mailchimp_lists_process_subscribe_form_choices in modules/mailchimp_lists/mailchimp_lists.module
Processor for various list form submissions.

File

./mailchimp.module, line 943
Mailchimp module.

Code

function mailchimp_unsubscribe_member($list_id, $email, $delete = FALSE, $goodbye = FALSE, $notify = FALSE) {
  $result = FALSE;
  if (mailchimp_is_subscribed($list_id, $email)) {
    if (variable_get('mailchimp_cron', FALSE)) {
      $result = mailchimp_addto_queue('mailchimp_unsubscribe_process', array(
        'list_id' => $list_id,
        'email' => $email,
        'delete' => $delete,
        'goodbye' => $goodbye,
        'notify' => $notify,
      ));
    }
    else {
      $result = mailchimp_unsubscribe_process($list_id, $email, $delete, $goodbye, $notify);
    }
  }
  return $result;
}