Back to vBulletin 3.0 Add-Ons

Restrict usernames to alphanumeric and underscore
Mod Version: 1.00, by Reynaldovb

This modification is in the archives.
vB Version: 3.0.3 Rating: (1 vote - 5.00 average) Installs: 28
Released: 31 Dec 2004 Last Update: Never Downloads: 2
Not Supported  

In response to
http://www.vbulletin.com/forum/showthread.php?p=772614#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:
$errors = array(); 
Add the following just below that
PHP Code:
//--------------------------------------------------
    // check username does not contain UNWANTED characters
    
if (preg_match('/[^a-zA-Z0-9\_]+/'$_POST['username']))
    {
        
//eval(print_standard_error('error_username_semicolon'));
        
eval('$errors[11] = "' fetch_phrase('username_invalidchars'PHRASETYPEID_ERROR) . '";');
    }
//------------------------------------------------- 

That's it, enjoy it.

Download

No files for download.

Similar Mods

Restrict usernames to alphanumeric and underscore vBulletin 3.5 Add-ons
Mini Mods Restrict usernames to alphanumeric and underscore vBulletin 3.7 Add-ons

vblts.ru supports vBulletin®, 2022-2024