function cleantalk_validate_newsletter in Anti Spam by CleanTalk 7.5
Cleantalk newsletter validation function.
1 string reference to 'cleantalk_validate_newsletter'
- _cleantalk_form_alter in ./
cleantalk.module - Cleantalk inner function - alters needed form.
File
- ./
cleantalk.module, line 48 - Main CleanTalk integration module functions.
Code
function cleantalk_validate_newsletter(&$form, &$form_state) {
global $user;
if (CleantalkFuncs::_cleantalk_check_form_submit_handlers($form_state['triggering_element']['#parents'])) {
$spam_check = array();
$spam_check['type'] = 'comment';
$spam_check['sender_email'] = !empty($form_state['values']['email']) ? $form_state['values']['email'] : '';
$spam_check['sender_nickname'] = !empty($form_state['values']['firstname']) && !empty($form_state['values']['lastname']) ? $form_state['values']['firstname'] . $form_state['values']['lastname'] : '';
$spam_check['message_title'] = '';
$spam_check['message_body'] = '';
$spam_result = CleantalkFuncs::_cleantalk_check_spam($spam_check, form_get_errors());
if (isset($spam_result) && is_array($spam_result) && $spam_result['errno'] == 0 && $spam_result['allow'] != 1) {
form_set_error('email', $spam_result['ct_result_comment']);
}
}
}