function mail_debugger_user_form_validate in Mail Debugger 7.3
Validate if the email address is known, and do a suggestion.
Parameters
type $values:
type $elements:
array $form_state:
1 string reference to 'mail_debugger_user_form_validate'
- mail_debugger_common_mail_debugger_info in modules/
common/ mail_debugger_common.module - Implement hook_mail_debugger_info();
File
- modules/
common/ includes/ user.mail_debugger.inc, line 46
Code
function mail_debugger_user_form_validate($values, $elements, &$form_state) {
// is it a valid e-mail address?
if (!valid_email_address($values['mail'])) {
form_set_error($elements['mail'], t('Enter a valid e-mail address.'));
return;
}
// load user by mail?
$user = user_load_by_mail($values['mail']);
// no user or anonimous?
if (empty($user->uid)) {
form_set_error($elements['mail'], t('This e-mail address does not match any user.'));
return;
}
}