The Arcive of vBulletin Modifications Site. |
|
Limited character set in usernames (Registration) Details »»
|
|||||||||||||||||||||||||||
|
Limited character set in usernames (Registration)
Developer Last Online: Mar 2014
I had the problem that I wanted to limit the possible usernames to a special set of characters - a regular expression.
Vb has only a function to disallow special characters, but this is not what I need, I wanted to have the first character is a char, other characters are char or numeric and the only special chars are "-" and "_". Here is my solution I want to share with you: Open register.php find: Code:
if (preg_match('/(?<!&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5});/', $_POST['username']))
Code:
if (!preg_match('/^([a-zA-Z][a-zA-Z0-9-_]*)$/', $_POST['username']))
That it ![]() I don't want to give support for this hack, because most question will probably be about regex and I'm not a regex-guru and I don't think that there is any need for support - but I'll watch this thread.arpy EDIT: I don't believe it - I've searched for a solution this morning, couldn't find anything and produced this hack - and now, a half hour ago Reynaldovb also released a very similiar hack here: https://vborg.vbsupport.ru/showthrea...threadid=73559. I didn't know about the thread he mentioned. So please choose which hack meets your need best. Show Your Support
|
|||||||||||||||||||||||||||
| Comments |
|
#2
|
|||
|
|||
|
it was just released also
|
![]() |
|
|