![]() |
Restrict usernames to alphanumeric and underscore
In response to
http://www.vbulletin.com/forum/showt...614#post772614 User memobug wanted (and myself too) to have a way to restrict usernames to alphanumeric chars and underscore. To me it has been a headache with a lot of users because their password didn't work, just to find after investigation that their usernames had an space and they were writing it without it. I hope this helps others as it has helped me. Here are the instructions to do it. 1) Go to your Admin Control Panel, Phrases Manager and create a new phrase named "username_invalidchars" in the "Front-end error messages" section. For the text use something like "Username has invalid characters. Only characters allowed are letters, numbers and underscore." 2.- Open /forums/register.php Somewhere around line 187 you will find the following PHP Code:
PHP Code:
That's it, enjoy it. |
Many thanks for this. I will be checking it out over the next week or so. It will come in very handy with some new features we hope to add to our website. One for example puts the username in a path to create a custom folder, so cleaning up the usernames like this is ideal.
Regards, Matt |
Memo, I must warn you that this not correct current usernames, just the new ones. If you would like something like that, you would have to run a query directly against the DB searching and Replacing forbidden characters and then rebuilding user count and titles.
|
just curious what symbols does it block ?
i was told to use the illegal username thing, but at least this will do it properly... i dont want to block the underscore ..... ? but i do want to block all of the following: ! " £ $ % ^ & * ( ) + - = : ~ # / \ ` ¬ | ? . , > < |
Quote:
Concerning the instructions, installation went fine. You might want to clarify that the new phrase goes in "Front-End Error Messages" not Front-End User Messages" (which doesn't exist). Thanks again, Matt |
Quote:
No other symbols or spaces. Regards, Matt |
Thanks Reynaldo!
|
80 new members registered in the past five days. Not a one with a wacko username.
The days of .:VirtualInsanity:. /<not " J-i-m " Are finally over. Thank you! Regards, Matt |
Will this hack allow usernames with a blank space, such as "John Doe", or will this allow only "John_Doe"?
|
Quote:
|
All times are GMT. The time now is 11:37 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|