Commit f6033d29 authored by Steven Wittens's avatar Steven Wittens

#10733: fixing broken user registration due to roles selection patch.

parent 94e759a8
......@@ -928,6 +928,7 @@ function user_register($edit = array()) {
}
if ($edit) {
$edit['roles'] = array(_user_authenticated_id()); // needed for validation
user_module_invoke('validate', $edit, $edit, 'account');
if (!form_get_errors()) {
......@@ -936,7 +937,7 @@ function user_register($edit = array()) {
// TODO: Is this necessary? Won't session_write() replicate this?
unset($edit['session']);
$account = user_save('', array('name' => $edit['name'], 'pass' => $pass, 'init' => $edit['mail'], 'mail' => $edit['mail'], 'roles' => array(_user_authenticated_id()), 'status' => (variable_get('user_register', 1) == 1 ? 1 : 0)));
$account = user_save('', array('name' => $edit['name'], 'pass' => $pass, 'init' => $edit['mail'], 'mail' => $edit['mail'], 'roles' => $edit['roles'], 'status' => (variable_get('user_register', 1) == 1 ? 1 : 0)));
watchdog('user', t('New user: %name %e-mail.', array('%name' => '<em>'. $edit['name'] .'</em>', '%e-mail' => '<em>&lt;'. $edit['mail'] .'&gt;</em>')), l(t('edit'), 'user/'. $account->uid .'/edit'));
$variables = array('%username' => $edit['name'], '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $edit['mail'], '%date' => format_date(time()), '%login_uri' => url('user/login', NULL, NULL, TRUE), '%edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE));
......
......@@ -928,6 +928,7 @@ function user_register($edit = array()) {
}
if ($edit) {
$edit['roles'] = array(_user_authenticated_id()); // needed for validation
user_module_invoke('validate', $edit, $edit, 'account');
if (!form_get_errors()) {
......@@ -936,7 +937,7 @@ function user_register($edit = array()) {
// TODO: Is this necessary? Won't session_write() replicate this?
unset($edit['session']);
$account = user_save('', array('name' => $edit['name'], 'pass' => $pass, 'init' => $edit['mail'], 'mail' => $edit['mail'], 'roles' => array(_user_authenticated_id()), 'status' => (variable_get('user_register', 1) == 1 ? 1 : 0)));
$account = user_save('', array('name' => $edit['name'], 'pass' => $pass, 'init' => $edit['mail'], 'mail' => $edit['mail'], 'roles' => $edit['roles'], 'status' => (variable_get('user_register', 1) == 1 ? 1 : 0)));
watchdog('user', t('New user: %name %e-mail.', array('%name' => '<em>'. $edit['name'] .'</em>', '%e-mail' => '<em>&lt;'. $edit['mail'] .'&gt;</em>')), l(t('edit'), 'user/'. $account->uid .'/edit'));
$variables = array('%username' => $edit['name'], '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $edit['mail'], '%date' => format_date(time()), '%login_uri' => url('user/login', NULL, NULL, TRUE), '%edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment