function logintoboggan_user_register_validate in LoginToboggan 7
Same name and namespace in other branches
- 5 logintoboggan.module \logintoboggan_user_register_validate()
- 6 logintoboggan.module \logintoboggan_user_register_validate()
Custom validation function for user registration form
1 string reference to 'logintoboggan_user_register_validate'
- logintoboggan_form_user_register_form_alter in ./
logintoboggan.module - Implement hook_form_user_register_form_alter().
File
- ./
logintoboggan.module, line 551 - LoginToboggan module
Code
function logintoboggan_user_register_validate($form, &$form_state) {
//Check to see whether our username matches any email address currently in the system.
if ($mail = db_query("SELECT mail FROM {users} WHERE LOWER(:name) = LOWER(mail)", array(
':name' => $form_state['values']['name'],
))
->fetchField()) {
form_set_error('name', t('This e-mail has already been taken by another user.'));
}
//Check to see whether our e-mail address matches the confirm address if enabled.
if (variable_get('logintoboggan_confirm_email_at_registration', 0) && isset($form_state['values']['conf_mail'])) {
if (trim($form_state['values']['mail']) != trim($form_state['values']['conf_mail'])) {
form_set_error('conf_mail', t('Your e-mail address and confirmed e-mail address must match.'));
}
}
//Do some password validation if password selection is enabled.
if (!variable_get('user_email_verification', TRUE)) {
$pass_err = logintoboggan_validate_pass($form_state['values']['pass']);
if ($pass_err) {
form_set_error('pass', $pass_err);
}
}
}