--- user.orig.module 2006-08-24 14:15:03.000000000 -0700
+++ user.module 2006-09-05 14:08:44.000000000 -0700
@@ -1256,7 +1256,7 @@
return 'user/register';
}
- $account = user_save('', array_merge($form_values, array('pass' => $pass, 'init' => $mail, 'status' => ($admin || variable_get('user_register', 1) == 1))));
+ $account = user_save($form_values['_account'] ? $form_values['_account'] : '', array_merge($form_values, array('pass' => $pass, 'init' => $mail, 'status' => ($admin || variable_get('user_register', 1) == 1))));
watchdog('user', t('New user: %name %email.', array('%name' => theme('placeholder', $name), '%email' => theme('placeholder', '<'. $mail .'>'))), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $account->uid .'/edit'));
$variables = array('%username' => $name, '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $mail, '%date' => format_date(time()), '%login_uri' => url('user', NULL, NULL, TRUE), '%edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE), '%login_url' => user_pass_reset_url($account));
@@ -1335,6 +1335,7 @@
);
if (user_access('administer users')) {
$form['account']['status'] = array('#type' => 'radios', '#title' => t('Status'), '#default_value' => $edit['status'], '#options' => array(t('Blocked'), t('Active')));
+ $form['account']['resend'] = array('#type' => 'checkbox', '#title' => ''.t('Resend new user account email').'', '#default_value' => 0, '#weight' => 10, '#description' => t('Check this box if you wish to resend the new user account notification. If you have not entered in a password, the user\'s password will be re-generated and they will receive the welcome email again.'));
}
if (user_access('administer access control')) {
$roles = user_roles(1);
@@ -1467,6 +1468,13 @@
function user_edit_submit($form_id, $form_values) {
$account = $form_values['_account'];
$category = $form_values['_category'];
+ // Resend new user notification:
+ if ($form_values['resend']) {
+ drupal_set_message(''.t('Resetting the user account.').'');
+ $form_values['notify'] = 1;
+ if (!$form_values['pass']) $form_values['pass'] = user_password();
+ user_register_submit($form_id, $form_values);
+ }
unset($form_values['_account'], $form_values['submit'], $form_values['delete'], $form_values['form_id'], $form_values['_category']);
user_module_invoke('submit', $form_values, $account, $category);
user_save($account, $form_values, $category);