function mailchimp_unsubscribe_form_submit in Mailchimp 7
Same name and namespace in other branches
- 5.2 mailchimp.module \mailchimp_unsubscribe_form_submit()
- 5 mailchimp.module \mailchimp_unsubscribe_form_submit()
- 6.2 mailchimp.module \mailchimp_unsubscribe_form_submit()
- 6 mailchimp.module \mailchimp_unsubscribe_form_submit()
submit handler for unsubscribe form
_state
Parameters
<type> $form:
File
- ./
mailchimp.module, line 719 - Mailchimp module.
Code
function mailchimp_unsubscribe_form_submit($form, &$form_state) {
if ($q = _mailchimp_get_api_object()) {
$success = TRUE;
foreach ((array) $q
->lists() as $list) {
$success = $success && _mailchimp_unsubscribe_user($list, $form_state['values']['EMAIL'], TRUE, $q);
if ($success) {
drupal_set_message(variable_get('mailchimp_unsubscription_success_message', t('Thank you, you have been successfully unsubscribed.')));
}
else {
drupal_set_message(variable_get('mailchimp_unsubscription_failure_message', t('We were unable to unsubscribe you at this time. Please try again later.')));
}
}
}
}