This is my first bug out here. Not sure it is a bug or a feature enhancement. :(..
I tried to create a normal user using the admin account and wanted to make that user to be blocked initially. But, the user is not getting blocked even though i select "blocked" as the status. Instead, the user gets created with "active" status.
Steps to reproduce:
1. Login as "admin" user
2. Select "Administer > User Management > Users"
3. Click "Add User"
4. Give any value for username, password and email
5. In the status section, set the status as "blocked"
6. Click "create new account" and check the list of users page
I digged into source code and analysed data passed to user_save function in modules/user/user.module,
Line 2616: $account = user_save('', array_merge($form_values, array('pass' => $pass, 'init' => $mail, 'roles' => $roles, 'status' => ($admin || variable_get('user_register', 1) == 1))));
This particular condition,
($admin || variable_get('user_register', 1) == 1)
always yields 1 (which is the active status). I dont know how to tweak it to work out.. :(..
Comment | File | Size | Author |
---|---|---|---|
#2 | user_adminstatus.patch | 1.7 KB | ChrisKennedy |
Comments
Comment #1
ChrisKennedy CreditAttribution: ChrisKennedy commentedConfirmed that this is a bug in user_register_submit(). Attached patch fixes it.
I performed four tests:
1. Admin && status == blocked -> blocked.
2. Admin && status == active -> active.
3. User && user_register == 1 -> active.
4. User && user_register == 2 -> blocked.
So it appears to work as intended.
Comment #2
ChrisKennedy CreditAttribution: ChrisKennedy commentedHere's the patch.
Comment #3
Steven CreditAttribution: Steven commentedTested and verified. Good job, committed to HEAD.
Comment #4
(not verified) CreditAttribution: commented