function mailchimp_unsubscribe_form_validate in Mailchimp 5.2
Same name and namespace in other branches
- 5 mailchimp.module \mailchimp_unsubscribe_form_validate()
- 6 mailchimp.module \mailchimp_unsubscribe_form_validate()
- 7 mailchimp.module \mailchimp_unsubscribe_form_validate()
File
- ./
mailchimp.module, line 564
Code
function mailchimp_unsubscribe_form_validate($form_id, $form_values) {
if (!$form_values['EMAIL']) {
form_set_error('EMAIL', t('Please enter your email address.'));
}
else {
if ($q || ($q = _mailchimp_get_api_object())) {
$subscribed = FALSE;
foreach ((array) $q
->lists() as $list) {
$subscribed = $subscribed || _mailchimp_is_subscribed($list['id'], $form_values['EMAIL'], $q);
}
if (!$subscribed) {
form_set_error('', t('That email address could not be found.'));
}
}
else {
form_set_error('', t('There was an error processing your request. Please try again later.'));
}
}
}