function mailchimp_unsubscribe in Mailchimp 8
Same name and namespace in other branches
- 7.3 mailchimp.module \mailchimp_unsubscribe()
- 2.x mailchimp.module \mailchimp_unsubscribe()
Unsubscribes a member from a Mailchimp list.
See also
Mailchimp_Lists::unsubscribe()
2 calls to mailchimp_unsubscribe()
- MailchimpListsSubscriptionTest::testUnsubscribe in modules/
mailchimp_lists/ src/ Tests/ MailchimpListsSubscriptionTest.php - 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 814 - Mailchimp module.
Code
function mailchimp_unsubscribe($list_id, $email) {
$config = \Drupal::config('mailchimp.settings');
$result = FALSE;
if (mailchimp_is_subscribed($list_id, $email)) {
if ($config
->get('cron')) {
$result = mailchimp_addto_queue('mailchimp_unsubscribe_process', [
'list_id' => $list_id,
'email' => $email,
]);
}
else {
$result = mailchimp_unsubscribe_process($list_id, $email);
}
}
return $result;
}