Phrase Type: Front-End Error Messages
Varname: az09charactersonly
Text: Only characters A-Z, 0-9 may be used in usernames, no spaces, no special ascii-type letters.
Phrase Type: vBulletin Settings
Varname: setting_az09characters_title
Text: Disallow Special Characters
Phrase type: vBulletin Settings
Varname: setting_az09characters_desc
Text: Setting this to "yes" prevents users from using special characters or spaces in there user name.
File Modifications:
Open:
[forumroot]/register.php
Find:
PHP Code:
// check username does not contain semi-colons
if (preg_match('/(?<!&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5});/', $_POST['username']))
{
//eval(print_standard_error('error_username_semicolon'));
eval('$errors[10] = "' . fetch_phrase('username_semicolon', PHRASETYPEID_ERROR) . '";');
}
Above that add:
PHP Code:
// Only A-Z, 0-9 Characters Only */
if ($vboptions['az09characters'])
{
if (!eregi("^[A-Za-z0-9]+$", $_POST['username']))
{
eval(print_standard_error('error_az09charactersonly'));
}
}
Save:
register.php
Now users can not use special chars or spaces in their username when signing up.
To disable the function goto, Admin CP > vBulletin Options > User Registration Options.
Find the yes/no option under ?Disallow Special Characters ?
How can I use this to allow a-z A-z 0-9 and spaces?? In other words what would I need to do to get this existing hack to work but still allow spaces in usernames??
How can I use this to allow a-z A-z 0-9 and spaces?? In other words what would I need to do to get this existing hack to work but still allow spaces in usernames??
PHP Code:
// Only A-Z, 0-9 [:space:] Characters Only */ if ($vboptions['az09characters']) { if (!eregi("^[A-Za-z0-9 ]+$", $_POST['username'])) { eval(print_standard_error('error_az09charactersonly')); } }
Like you asked, how to allow spaces? Just put a space in the regex
Nice hack bro, but could you please make a vBulletin option that would allow board administrator to specify a custom allowed letter range (so that besides English, another language or languages would be allowed)? Thanks
Nice hack bro, but could you please make a vBulletin option that would allow board administrator to specify a custom allowed letter range (so that besides English, another language or languages would be allowed)? Thanks
Will look into that m8, however 3.5.0 version it will be.
a vBulletin option that would allow board administrator to specify a custom allowed letter range (so that besides English, another language or languages would be allowed)
Hmm let me think, i could make a field in the options where you can enter your own regex? Would that do the job ? Because i'm not a regex freak :disappointed:
if (!eregi("^[A-Za-z" . $vboptions['mycustomoption'] . "0-9]+$", $_POST['username']))
That way when the option is filled by the admin, it will automatically be inserted into your regex
Also, a shorter form of "A-Za-z" in a regex would be a simple "A-z"
// Only A-Z, 0-9 [:space:] Characters Only */ if ($vboptions['az09characters']) { if (!eregi("^[A-Za-z0-9 ]+$", $_POST['username'])) { eval(print_standard_error('error_az09charactersonly')); } }
Like you asked, how to allow spaces? Just put a space in the regex
Is there a way to modify this to accept dash and underscore as valid characters?