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

What are the allowable characters in a name?

Discussion in 'XenForo Questions and Support' started by bottiger, Feb 5, 2012.

  1. bottiger

    bottiger Active Member

    What are the allowable characters in a xenforo name?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Whatever you set in Options -> User Registration: User Name Match Regular Expression
     
  3. bottiger

    bottiger Active Member

    I know there's more than that. I got an error message about control characters.
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Commas are not allowed as they are used to delimit lists of usernames. There are no other restricted characters to my knowledge. But of course you can impose your own requirements on usernames by defining a regex as Brogan pointed out.
     
  5. bottiger

    bottiger Active Member

    There are other restricted characters.

    This regex allowed one of the problem names to work.

    [\u0000-\u001f\u0080-\u009f]

    I need to know if there are more.
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    This function verifies usernames:

    XenForo_DataWriter_User::_verifyUsername

    There are several restrictions, many of which are user-defined such as censored words.

    What error message are you getting? That will help to know which check is failing.
     
  7. bottiger

    bottiger Active Member

    Thanks that is more helpful. I got a "please_enter_name_without_using_control_characters" error.
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Ok, it is failing this check:

    Code:
    		// ignore check if unicode properties aren't compiled
    		try
    		{
    			if (@preg_match("/\p{C}/u", $username))
    			{
    				$this->error(new XenForo_Phrase('please_enter_name_without_using_control_characters'), 'username');
    				return false;
    			}
    		}
    		catch (Exception $e) {}
    
    For reference:
    http://en.wikipedia.org/wiki/Control_character
     

Share This Page