user_admin_create
Definition
user_admin_create($edit = array())
modules/user.module, line 1327
Code
<?php
function user_admin_create($edit = array()) {
if ($edit) {
// Because the admin form doesn't have roles selection they need to be set to validate properly
$edit['roles'] = array(_user_authenticated_id() => 'authenticated user');
user_module_invoke('validate', $edit, $edit, 'account');
if (!form_get_errors()) {
watchdog('user', t('New user: %name %email.', array('%name' => theme('placeholder', $edit['name']), '%email' => theme('placeholder', '<'. $edit['mail'] .'>'))));
user_save('', array('name' => $edit['name'], 'pass' => $edit['pass'], 'init' => $edit['mail'], 'mail' => $edit['mail'], 'roles' => $edit['roles'], 'status' => 1));
drupal_set_message(t('Created a new user account. No e-mail has been sent.'));
return;
}
}
$output = form_textfield(t('Username'), 'name', $edit['name'], 30, 55, t('Provide the username of the new account.'), NULL, TRUE);
$output .= form_textfield(t('E-mail address'), 'mail', $edit['mail'], 30, 55, t('Provide the e-mail address associated with the new account.'), NULL, TRUE);
$output .= form_password(t('Password'), 'pass', $edit['pass'], 30, 55, t('Provide a password for the new account.'), NULL, TRUE);
$output .= form_submit(t('Create account'));
$output = form_group(t('Create new user account'), $output);
return form($output);
}
?> 