View Full Version : Restrict usernames to alphanumeric and underscore
Reynaldovb
01-31-2006, 10:00 PM
This is a vB 3.5.x port of the same mini mod.
( https://vborg.vbsupport.ru/showthread.php?t=73559 )
What is this Plugin about?
Are you tired of seeing in your forums usernames like these?:
1.- The Super Boy (spaces)
2.- my_new_name (underscore abuse)
3.- im?a??nd?b?ar (international characters)
Well, with this simple addon you can prevent that from happening from now on (it can't correct already spoiled usernames). When a user tries to register using one of those chars, a nice error message makes sure the user picks another "normal" name.
Installation instructions
1.- Download the attached .xml
2.- Go to Admin Control Panel => Plugin System => Manage Products => Add/Import Product => and browse for the the location where you downloaded the .xml
3.- Hit Import
4.- To configure it (not really needed, but it is there), go to Vbulletin Forum Options => Restrict Usernames on registration
By default this addon prevents spaces and any char other than numbers and (english) letters while allowing underscore.
**
Fixed to work with 3.6.8 and 3.7
Reynaldovb
02-01-2006, 07:09 AM
--- This space left intentionally blank ---
redspider
02-01-2006, 07:12 AM
I got some new members that been using emails as user name would this block the @ symbol?
thank you
Reynaldovb
02-01-2006, 07:24 AM
I got some new members that been using emails as user name would this block the @ symbol?
thank you
Yes, by default it would block anything but letters a-z, numbers, and the underscore. Anything else and the user gets an error message asking him to modify his username.
In short: yes, it would block the @ symbol as well the dot used in .com|.net
redspider
02-01-2006, 07:28 AM
thank you.
hiiped
02-01-2006, 08:57 AM
good job
thanks
xswrex
02-01-2006, 09:38 AM
thank you, simple yet effective.
installed !!!
Snake
02-01-2006, 10:22 AM
I've it installed on my forums. Thanks!
duplu
02-01-2006, 10:27 AM
Thanks, just what I needed. I have another piece of software which feeds usernames off of the vbulletin user file and it doesn't like non-alphanumeric characters in the username - so this will be ideal.
Reynaldovb
02-01-2006, 03:42 PM
I remember when I moved from Xoops to vBulletin I wanted to start clean and "correct" those names with non alphanumeric chars, so I made an small tool that checked every name and if it didnt comply, changed it to normal standards.
It was a brute and ugly tool, but it did the job. After that I emailed all the users in the forum letting them know that some of them had their name changed, and included their current name in the email (vBulletin mailing system).
If you would want me to release that tool, I would be glad to help you get your forums "clean". LOL
the Sandman
02-01-2006, 03:53 PM
How does this interact with the default User Registration Options > Illegal User Names settings? I have some names and symbols in there already. Should I just leave them there? Remove the symbols and leave the words?
Reynaldovb
02-01-2006, 04:02 PM
How does this interact with the default User Registration Options > Illegal User Names settings? I have some names and symbols in there already. Should I just leave them there? Remove the symbols and leave the words?
As far as I know, that option is to prevent users from registering certain names, like "support", "password", "system" etc etc
This mod goes beyond that. You can still enter names on that vB setting, but the mod will prevent people from using any symbols that you hadnt explicity allowed (through the mod options).
the Sandman
02-01-2006, 04:26 PM
As far as I know, that option is to prevent users from registering certain names, like "support", "password", "system" etc etc
This mod goes beyond that. You can still enter names on that vB setting, but the mod will prevent people from using any symbols that you hadnt explicity allowed (through the mod options).It works for symbols as well - you just enter them one at a time with a space between them. There are two problems with using the default system for symbols though - you have to list them all, and if the user tries to register using one of them they don't get a message telling them why - they think the username is taken. So your solution is definitely better. I was just wondering how the two systems interact - which is checked first, yours or the default?
BTW, here's what I currently have in my default illegal username field: admin moderator ' ! @ # $ % ^ &* ( ) + | - = \ { [ } } : ; ' " < , > ? / ~ ` ' www .comI suppose I should remove all the symbols and leave the words?
Reynaldovb
02-01-2006, 04:34 PM
I have no idea, which one goes first. It would probably be the best idea to delete the symbols and leave just names there.
the Sandman
02-01-2006, 04:41 PM
I have no idea, which one goes first. It would probably be the best idea to delete the symbols and leave just names there.I did a test before removing the symbols from my default illegal user name field - the default system comes first FWIW.
Thanks! Great hack!
Thanks alot Reynaldovb!
That was pretty quick of you to come up with the port! :D
Very Happy!!
XFSImperial
02-02-2006, 01:55 AM
Thanks, I've been wanting something like this to block out all the annoying symbols people manage to find.
*installs*
sportsoutlaw
02-02-2006, 12:39 PM
Does this plugin allow you to use 1 underscore and just prevent the use of multiple underscores?
Reynaldovb
02-02-2006, 03:36 PM
Does this plugin allow you to use 1 underscore and just prevent the use of multiple underscores?
Hmmm. not really, people can use the allowed chars multiple times. I guess that is an idea for a next version ;-)
By the way, did you mean multiple underscores like this:
my_nick_name
or like this:
my___nickname
moonclamp
02-02-2006, 04:38 PM
What happens to users who already have illegal characters? Will they still be able to login or update their info?
Reynaldovb
02-02-2006, 04:43 PM
What happens to users who already have illegal characters? Will they still be able to login or update their info?
This mod only affects future registrations. Existing users would have to have their names changed.
If I remember correctly, I think I saw somewhere a piece of Search and Replace SQL code you could use to do a massive search and replace. Of course you would be wise to back up your database first and email the users letting them know about the change in their names.
moonclamp
02-02-2006, 04:50 PM
Cool, I'm fine with the existing members, I just want to restrict people who use email addresses as usernames. Ideally I'd love to be able to stop people using all uppercase names too but I guess we can't have everything.
Also ... If I wanted to allow more than one character (EG ~ and -) would I seperate them with spaces or commas?
Anyway, thank you ... just installed :)
quanvo81
02-19-2006, 07:54 PM
LOL
This is a cool hack.
You know what, I will creat alots more user names with space, @, uppercase....I think around hundreds of them, then install this hack.
The result is, the user names I created will be .... RARE . It means I can trade for something else if a member want that nick so bad . LOL, just like Yahoo ! rare nicks.
Lol, just a thought, I am not going have free time just to sit there and manual add users. But I will wait untill my board get busy and lots of users sign up, then I will installed this hack. At that time my board will be crazy with rare nicks trading.
thanks again.
ndahiya
03-02-2006, 09:56 PM
installed. thanks!
Joey805
03-03-2006, 06:27 PM
Works perfectly!
Thanks!
Nathan2006
03-16-2006, 12:42 AM
Thank you
Install
HolisticEarth
04-12-2006, 11:57 PM
Thank you for writing this plugin. It is a complete asset!
The default username restriction seems exceptionary while this system is inclusionary, meaning the default system lets you create exceptions for what you can register, while this system lets you include what can be registered.
This is much better IMO because people could keep finding characters that you haven't put on your ban list, and you would have to make an exception for each one.
It is very important for sites like mine (http://holisticearth.org) which in the end will have MediaWiki (http://mediawiki.org) integrated into it. MediaWiki can only allow printable characters in page names, and page names can be user names, so user names must be only printable characters. This hack solves the problem.
Again, thank you. Installed.
akanevsky
04-13-2006, 12:49 AM
[HOW-TO] Allow Russian Letters
Option 1:
Type А-я in the "custom symbol box".
Option 2:
In register_addmember_process, FIND
$ru_searchpattern .= "]+/";
ADD BEFORE
$ru_searchpattern .= "А-я";
dan35
04-13-2006, 05:23 AM
Thx! Installed :)
kj_ugs
06-15-2006, 05:40 PM
this works on 3.5.4 and can be fully uninstalled right? sounds good to me.
Kronomancer
07-13-2006, 05:05 PM
I get this in my template... "Could not find phrase 'username_invalidchars'."
3.6 beta 4... any help?
ndahiya
07-30-2006, 04:10 PM
I get this in my template... "Could not find phrase 'username_invalidchars'."
3.6 beta 4... any help?
so do i!!
magmf
10-20-2006, 07:32 PM
I get this in my template... "Could not find phrase 'username_invalidchars'."
3.6 beta 4... any help?
Me too
any solution ?
VbStudent1
10-25-2006, 09:52 AM
I will throw my hat in here as well. Is there a fix? The error is coming about due to PHRASETYPEID which has been removed in versions 3.6.x. Everything else works well except for the error message. Someone may know enough about SQL to make the plugin point to the correct phrase. I am only a beginner but I wouldn't think it would be too difficult.
KatScript
03-09-2007, 10:52 PM
I'm running version 3.6.5
I have attached my version.
or get the one from the download and do this:
Find:
eval('$userdata->errors[] = "' . fetch_phrase('username_invalidchars', PHRASETYPEID_ERROR) . '";');
Replace with:
$userdata->error('username_invalidchars');
Hope this helps someone.
RedGTiVR6
02-27-2008, 04:55 PM
Anyone know if this has been done in 3.7?
Reynaldovb
02-27-2008, 05:37 PM
I upgraded to 3.7 and it seems to be working, but I don't know if it would work on a brand new board. I would have to check and make the necessary corrections.
Reynaldovb
02-27-2008, 05:54 PM
Working on a fix...
RedGTiVR6
02-27-2008, 06:27 PM
Great! I'm just trying to go through all of my currently installed mods and see if they will work with 3.7 when we update.
Reynaldovb
02-27-2008, 07:00 PM
Great! I'm just trying to go through all of my currently installed mods and see if they will work with 3.7 when we update.
The updated version works with both 3.6.8 and 3.7
I dont have 3.5 version or lower anymore so I cant guarantee if it works with those.
rinkrat
03-02-2008, 12:10 AM
This will help my SEO. Installed.
futuredood
06-26-2008, 12:15 AM
wow thank you for the 3.6.8 fix! i hope this is default in future versions.
Ingress
06-28-2008, 03:54 PM
wow thank you for the 3.6.8 fix! i hope this is default in future versions.
In fact it is already, see "Username Regular Expression" under "User Registration Options". Therefore uninstalled.
Ingress
anestetic
02-01-2009, 11:20 AM
worked on 3.8 ?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.