• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Prevent all caps username

AndyB

Well-known member
#2
This will require the following:

1) Only the a-z A-Z and 0-9 are allowed.
2) Username cannot be all numbers.
3) Username cannot be all caps.

Code:
^[a-zA-Z0-9]*[a-zA-Z][a-zA-Z0-9]*[a-z][a-zA-Z0-9]*$
Add to the following field:

Admin Control Panel -> Options -> User Registration -> User Name Match Regular Expression:
 

AndyB

Well-known member
#3
Also be sure to edit the following phrase:

this_is_name_that_will_be_shown_with_your_messages

This is what I suggest:

This is the name that will be shown with your messages. All caps, all numbers, spaces and non-alphanumeric characters are not allowed.
 

Bob_R

Active member
#4
This will require the following:

1) Only the a-z A-Z and 0-9 are allowed.
2) Username cannot be all numbers.
3) Username cannot be all caps.

Code:
^[a-zA-Z0-9]*[a-zA-Z][a-zA-Z0-9]*[a-z][a-zA-Z0-9]*$
Add to the following field:

Admin Control Panel -> Options -> User Registration -> User Name Match Regular Expression:

So with this BSmith would be valid?

What about BFPierce?
 

AndyB

Well-known member
#7
Would this still allow social media based user registrations where they automatically use full name (and thus a space)?
Sorry I don't know if the User Name Match Regular Expression field is used during a social media registration.
 

Bob_R

Active member
#8
@AndyB On your suggestion to change the phrase, post (#3), it reads that no spaces are allowed in username.

I don't mind spaces, I don't mind John Smith as opposed to JohnSmith. I just don't want all caps, JOHNSMITH or JOHN SMITH.

Is your code from post#2 still adhere to this?
 

n00bsaibot

Well-known member
#9
To err on the safe side, can't you just edit all caps user later, instead of risking potential errors on user registration? Can't image you'd have too many people trying to get all caps.