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

XF 1.5 How To Keep Usernames In Check While Registration?

Discussion in 'XenForo Questions and Support' started by Divvens, Dec 24, 2015.

  1. Divvens

    Divvens Well-Known Member

    I wish to not allow special characters like Japanese Kanji/Special English characters (Spanish letters that have a special o, e etc) on usernames during registration.

    I want to allow: Numericals, alphabets, underscores and - , spaces.

    Is this possible? I don't mind having all special characters unusable apart from just underscore too.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Enter the regex you want to use in the User Name Match Regular Expression field.
    For example: ^[a-zA-Z0-9_ ]+$
     
    Divvens likes this.
  3. Divvens

    Divvens Well-Known Member

    Ah regex, thanks. I don't know about it, so I'll look it up, but is the regex you posted for alphabets, numerics & underscore?
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Yes, as well as space.
     
    Divvens likes this.
  5. Divvens

    Divvens Well-Known Member

    Thanks Brogan :)

    If I need to allow a period (dot) as well, would this work?

    ^[a-zA-Z0-9_. ]+$
     
  6. Brogan

    Brogan XenForo Moderator Staff Member

    Yes.
     
    Divvens likes this.
  7. rafass

    rafass Well-Known Member

    Just curious, what's the reason to don't allow this kind of weird characters in the username?
    It could cause future problems in the tables or something?
     
    Divvens likes this.
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Personal preference.
     
    Divvens likes this.
  9. Divvens

    Divvens Well-Known Member

    For us, it makes it very difficult for users to use the @mention feature if the username starts with special characters that cannot be typed by a default (vanilla) keyboard. It just takes out that bit of the community experience and interaction with said user gets a bit difficult, so we want to maintain usernames without special characters.
     
  10. rafass

    rafass Well-Known Member

    Thank you!
     

Share This Page