--- user.module.orig 2005-12-12 11:33:22.000000000 -0500 +++ user.module 2005-12-12 13:09:27.000000000 -0500 @@ -1074,7 +1074,7 @@ } $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#size' => 30, '#maxlength' => 64, '#description' => t('Your full name or your preferred username; only letters, numbers and spaces are allowed.'), '#required' => TRUE); $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#size' => 30, '#maxlength' => 64, '#description' => t('A password and instructions will be sent to this e-mail address, so make sure it is accurate.'), '#required' => TRUE); - if ($admin) { + if (variable_get('user_email_verification', 1) == 0 || $admin) { $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#size' => 30, '#maxlength' => 55, '#description' => t('Provide a password for the new account.'), '#required' => TRUE); } $extra = _user_forms($null, $null, $null, 'register'); @@ -1106,7 +1106,12 @@ $mail = $form_values['mail']; $name = $form_values['name']; - $pass = $admin ? $form_values['pass'] : user_password(); + if (variable_get('user_email_verification', 1) == 0 || $admin) { + $pass = $form_values['pass']; + } + else { + $pass = user_password(); + }; $from = variable_get('site_mail', ini_get('sendmail_from')); if (!$admin && array_intersect(array_keys($form_values), array('uid', 'roles', 'init', 'session', 'status'))) { @@ -1136,6 +1141,14 @@ drupal_goto('admin/user'); } + // No e-mail verification is required, create new user account, and login user immediately. + else if (variable_get('user_email_verification', 1) == 0 && $account->status) { + $subject = _user_mail_text('welcome_subject', $variables); + $body = _user_mail_text('welcome_body', $variables); + user_mail($edit['mail'], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from"); + user_authenticate($account->name, trim($pass)); + drupal_goto(); + } else if ($account->status) { // Create new user account, no administrator approval required. $subject = _user_mail_text('welcome_subject', $variables); @@ -1768,6 +1781,7 @@ // User registration settings. $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings')); $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register', 1), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.'))); + $form['registration']['user_email_verification'] = array('#type' => 'checkbox', '#title' => t('Require e-mail verification when a visitor creates an account'), '#return_value' => 1, '#default_value' => variable_get('user_email_verification', 1), '#description' => t('Check this box to require e-mail verification.')); $form['registration']['user_registration_help'] = array('#type' => 'textarea', '#title' => t('User registration guidelines'), '#default_value' => variable_get('user_registration_help', ''), '#description' => t('This text is displayed at the top of the user registration form. It\'s useful for helping or instructing your users.')); // User e-mail settings.