1. 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

Discussion in 'XenForo Questions and Support' started by Bob_R, Oct 5, 2015.

  1. Bob_R

    Bob_R Active Member

    Is there any method to prevent people from choosing all caps usernames?

    I can see BSmith but not BSMITH.
     
  2. AndyB

    AndyB Well-Known Member

    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:
     
  3. AndyB

    AndyB Well-Known Member

    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 likes this.
  4. Bob_R

    Bob_R Active Member


    So with this BSmith would be valid?

    What about BFPierce?
     
  5. AndyB

    AndyB Well-Known Member

    Correct those would be allowed.
     
  6. Mouth

    Mouth Well-Known Member

    Would this still allow social media based user registrations where they automatically use full name (and thus a space)?
     
  7. AndyB

    AndyB Well-Known Member

    Sorry I don't know if the User Name Match Regular Expression field is used during a social media registration.
     
  8. Bob_R

    Bob_R Active Member

    @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?
     
  9. n00bsaibot

    n00bsaibot Active Member

    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.
     

Share This Page