vb4 Illegal User Names & Username Regular Expression

Author:

phil

Created:

2010/04/07 - 10:52

Last Updated:

2010/04/07 - 11:26

My purpose in this is to give a decent example of how to use vBulletin's registration options: "Illegal User Names" along with its "Username Regular Expression" and allow comments to help build a working page dedicated to setting up a robust registration username process.

---

Recently setting up a vBulletin Forum for some folks, I ran across the registration settings of "Illegal User Names" where the admin can explicitly block a list of pre-defined usernames to prevent new users from registering themselves as: administrator, moderator etc. Out of the box, vBulletin will allow ALL characters whether ASCII or alphanumeric. Reading a few forums, others have had problems with the allowed use of certain ASCII characters and certain misleading words or the use of a "white space" in a username (Ex. john smith) which leads to people forgetting they put a space in their username and send e-mails to the admins to request a password change because they can't remember their password (they actually remember their passwords, not their username...) Anywho, lots of ways to create headaches...

What's nice about the Illegal User Names input, is the ability to block a user from registering any username based off of a shortened version. For example, if you add "mod" as an illegal username, it will also block "moderator" "sysmod" or anything that might mislead forum users of someone being a moderator.

Now, me personally, I decided to block some of the foul language words such as "fuck", "bitch", "shit", "asshole" etc. and I decided that I wanted the use of alphanumeric characters, along with an underscore: _ period: . and hyphen: -

While the extra characters are nice, if the "Illegal User Names" section isn't setup properly, it can create a scenario where a user can register with a username such as: "______" or "..." or "-----".

I won't go into a whole lot of explanation detail on how things work or why, but I will at least show what I did to make things work.

1) Login to the vBulletin Admin cPanel
2) Options -> User Registration Options
3) Look for the heading: Illegal User Names
4) Add any words you want to block.
5) Look for "Username Regular Expression" (right under Illegal User Names)
6) Add the following: ^[A-Z0-9_\.\-]+$

Now that you have that setup, go back to the Illegal User Names and add the following:

.. __ --

which will prevent someone from registering "------" etc.

At this point, this is merely a collection of thoughts... I would love to add to it provided [you] send in info on usernames worth blocking and regular expressions that tickle your fancy. If you do leave a comment with a regular expression, be sure to explain what all it blocks for those of us who don't fully understand how regular expressions work.

List of Illegal User Names

bitch fuck asshole shit admin mod sysop

List of Regular Expressions

Borrowed from: WebCheatSheet.com
Here is a great starting point of regular expressions to use

Regular Expression Will match...
foo The string "foo"
^foo "foo" at the start of a string
foo$ "foo" at the end of a string
^foo$ "foo" when it is alone on a string
[abc] a, b, or c
[a-z] Any lowercase letter
[^A-Z] Any character that is not a uppercase letter
(gif|jpg) Matches either "gif" or "jpeg"
[a-z]+ One or more lowercase letters
[0-9\.\-] ?ny number, dot, or minus sign
^[a-zA-Z0-9_]{1,}$ Any word of at least one letter, number or _
([wx])([yz]) wy, wz, xy, or xz
[^A-Za-z0-9] Any symbol (not a number or a letter)
([A-Z]{3}|[0-9]{4}) Matches three letters or four numbers

Post Comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.

Comments

Use Lowercase


Very useful!!

Just wondering why you decided not to use lowercase letters?

I dunno...


Hum, to be honest, I don't know... lol

For some reason, It will accept upper and lower with the posted configuration... I guess if it is forcing uppercase for you, then put in :^[a-zA-Z0-9_\.\-]+$ instead.

The Wichita Computer Guy is hosted by one of the best hosting companies on the market: Hostgator.com. Not only do they provide unlimited domain addons, subdomains and parked domains, they also offer unlimited databases, unlimited hosting space and unlimited bandwidth! We have been using Hostgator for several years now and had great customer service support and almost 100% uptime. If you are looking for a website hosting company that provides everything you need for a powerful CMS based website, take a look at Hostgator.com!!