![]() |
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:
|
Reynaldovb,
Thank you Thank you Thank you To be suprised I am not sure why this isn't a default item within vB. The amount of work generated by users saying "my log in doesn't work" all because of spaces and symbols is incredible. Shawno |
Do I put \- at then end to add the "-" symbol? I dont mind having that as well.
|
T3Media:
Yes, it would be something like this: PHP Code:
|
Respect due. Thanks. Just needed to verify.
|
* clicks install *
I haven't had a problem with user names like >>..@---@..<< yet !!! However, I don't want to have such problems!!! Thank you. I'm going to test this out. And I only have 85 members, so I will email a few of them to notify them that an underscore has been added to their names. (I will add them manually) |
Does anybody which part in CSS to modify the error message color. The error message color on my forum is so light, that it can barely be seen.
Thanks. UPDATE.......... I found it. Page Background, Font Color |
i've installed V3.0.6
following code in register.php PHP Code:
|
PHP Code:
I am using one :) |
Lizard King:
No, I think the correct way to do it would be something like this: PHP Code:
|
I would like to install this hack in vB 3.06. I would also like to allow spaces in usernames. Which of the above code would be correct to use in 3.06?
Thanks |
Quote:
PHP Code:
|
Thank you Reynaldovb. The hack works perfectly. I also allowed space and the period.
|
installed
nice simple hack mucho thanks |
This is great but I need it to go one further..... my new users must have both letters and numbers in their user name. How do I do that?
|
*bump*
|
It looks to me that it will allow numbers and letters already.
|
Quote:
Any one? |
I have been looking, but have not found anything that I can get working. This WOULD be nice to have...
|
Simple little nice hack *clicks install* :)
|
Hi all,
Will this work on vB 3.5.3 ? If not, can anyone... perhaps port or upgrade it ? |
It would probably work but it is not recommended, and my knowledge about how vB 3.5+ works is not as good as I would want to. I could try to port it next weekend as I need it for my forums too. :-(
|
Well, what do you know? I decided to give it a try and in just a few minutes I had a working version for vB 3.5.x :-)
https://vborg.vbsupport.ru/showthread.php?t=106877 |
Thanks, Works great!! Cheers!
|
I couldn't find your original anchor point in register.php so I put it in the code just after referrer and before the image check. It looks like this:
PHP Code:
|
Quote:
|
All times are GMT. The time now is 09:24 PM. |
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:
|