summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/user/user.module10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index 18349a13d..8d39719eb 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -3679,6 +3679,14 @@ function user_register_form($form, &$form_state) {
$admin = user_access('administer users');
+ // Pass access information to the submit handler. Running an access check
+ // inside the submit function interferes with form processing and breaks
+ // hook_form_alter().
+ $form['administer_users'] = array(
+ '#type' => 'value',
+ '#value' => $admin,
+ );
+
// If we aren't admin but already logged on, go to the user page instead.
if (!$admin && $user->uid) {
drupal_goto('user/' . $user->uid);
@@ -3737,7 +3745,7 @@ function user_register_validate($form, &$form_state) {
* @see user_register_form()
*/
function user_register_submit($form, &$form_state) {
- $admin = user_access('administer users');
+ $admin = $form_state['values']['administer_users'];
if (!variable_get('user_email_verification', TRUE) || $admin) {
$pass = $form_state['values']['pass'];