function _user_edit_validate in Drupal 4
Same name and namespace in other branches
- 5 modules/user/user.module \_user_edit_validate()
- 6 modules/user/user.module \_user_edit_validate()
1 call to _user_edit_validate()
- user_user in modules/
user.module - Implementation of hook_user().
File
- modules/
user.module, line 1354 - Enables the user registration and login system.
Code
function _user_edit_validate($uid, &$edit) {
$user = user_load(array(
'uid' => $uid,
));
// Validate the username:
if (user_access('change own username') || user_access('administer users') || arg(1) == 'register') {
if ($error = user_validate_name($edit['name'])) {
form_set_error('name', $error);
}
else {
if (db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND LOWER(name) = LOWER('%s')", $uid, $edit['name'])) > 0) {
form_set_error('name', t('The name %name is already taken.', array(
'%name' => theme('placeholder', $edit['name']),
)));
}
else {
if (drupal_is_denied('user', $edit['name'])) {
form_set_error('name', t('The name %name has been denied access.', array(
'%name' => theme('placeholder', $edit['name']),
)));
}
}
}
}
// Validate the e-mail address:
if ($error = user_validate_mail($edit['mail'])) {
form_set_error('mail', $error);
}
else {
if (db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) {
form_set_error('mail', t('The e-mail address %email is already taken.', array(
'%email' => theme('placeholder', $edit['mail']),
)));
}
else {
if (drupal_is_denied('mail', $edit['mail'])) {
form_set_error('mail', t('The e-mail address %email has been denied access.', array(
'%email' => theme('placeholder', $edit['mail']),
)));
}
}
}
// If required, validate the uploaded picture.
if ($file = file_check_upload('picture_upload')) {
user_validate_picture($file, $edit, $user);
}
}