Bulk delete: Empty username fails with error/moodle/usernamelowercase
During the last attempt it brings:
Only lowercase allowed (my translation)
Debug info:
Error code: usernamelowercase
Stack trace:
line 120 of /user/lib.php: moodle_exception thrown
line 4289 of /lib/moodlelib.php: call to user_update_user()
line 30 of /admin/user/user_bulk_delete.php: call to delete_user()
Link to further info:
https://docs.moodle.org/27/de/error/moodle/usernamelowercase
Is this is a result of an added security mechanism? What is the best way out?
[Moodle 2.7.1+ (Build: 20140731)] (I know, 2.7 is no more supported except for security exploits. But don't just tell me to upgrade, unless you know that the target version, ideally 2.7.latest, does not have this "bug".)
Re: Bulk delete: Empty username fails with error/moodle/usernamelowercase
I can't understand how you end up at the user_update_user() function with an empty username in the first place. You can't have a user profile with a blank username surely? There's a bigger bug here if so.
Can you step through how to reproduce this (assuming that we don't have 'no authentication' enabled in the first place)?
Re: Bulk delete: Empty username fails with error/moodle/usernamelowercase
No, I don't think you can maneuver in to this corner without the help of "No authentication".
OK, now step-by-step.
- Site administration > Plugins > Authentication > No authentication is active with First name, Surname and Email address, amoung other things, are unlocked.
- Site administration > Plugins > Authentication > Manage authentication shows 7 Manual accounts, 0 No logins and 4517(!) No authentication accounts.
- Once I go to Site administration > Users > Accounts > Bulk user actions and filter User full name, Surname, First name, Email address all "is empty" the column Available shows "All filtered (1306/4523)".
- Now I say, Add to selection, Selection responds with "All selected (1306/4523)"
- Then With selected users... > Delete > Go I get a " Are you absolutely sure you want to completely delete" followed by a whole page of dots.
- The Yes to that brings the error already mentioned:
Only lowercase letters allowed
Debug info:
Error code: usernamelowercase
Stack trace:
line 120 of /user/lib.php: moodle_exception thrown
line 4289 of /lib/moodlelib.php: call to user_update_user()
line 30 of /admin/user/user_bulk_delete.php: call to delete_user()
I may find a SQL to purge those users. But that would be as a last resort. I want the site admin to be able to repeat the exercise (and take the responsibility ;).
Re: Bulk delete: Empty username fails with error/moodle/usernamelowercase
Unsure... I'll need to attempt to reproduce this to find out what has gone wrong. It sounds like one of those things that nobody is likely to have tested.
I'll have a try but it might not be today
Re: Bulk delete: Empty username fails with error/moodle/usernamelowercase
I didn't mean that! Unless "No authentication" is your child, don't spend your time on this. Just shift the discussion to the Authentication forum. I need to have a second look anyway.
Re: Bulk delete: Empty username fails with error/moodle/usernamelowercase
I doubt it's anybody's child. Moving to authentication, but if I get a minute I'll have a try. I like a mystery
Re: Bulk delete: Empty username fails with error/moodle/usernamelowercase
"Re: Only lowercase letters allowed" https://moodle.org/mod/forum/discuss.php?d=279399 (Mauno's posts at the bottom, specifically https://tracker.moodle.org/browse/MDL-46232)
So this is an existing and known bug?
Re: Bulk delete: Empty username fails with error/moodle/usernamelowercase
Just came across this exact same error when we tried to delete some old accounts. Were on Moodle 2.8
All our accounts are setup via LDAP sync, but there were and handful of accounts that didn't have an e-mail address setup.
I did an export of the accounts that i needed to delete, added in a bogus email address to them all. Imported users to update the existing accounts and then re-ran the Bulk delete.
Worked like a charm.
Thanks for the help in finding out the issue on this one.
-Shawn
Re: Bulk delete: Empty username fails with error/moodle/usernamelowercase [RESOLVED]
@Howard, thanks a lot for your support and sorry for the very late report!