• Resolved totalgraybear

    (@totalgraybear)


    How do I limit the size of Usernames that people use to register on my WP site? I just tried a username with several hundred letters, and it let me register. Problem is, it screws up the look of the site, looks plain weird.
    Any way to limit the size?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter totalgraybear

    (@totalgraybear)

    bump, anyone there?

    Guess you could add something like this to the validate_username function in wp-includes/registration.php. Change the 10 to whatever length you want…

    if ( strlen($username) > 10 )
    		$valid = false;
    Thread Starter totalgraybear

    (@totalgraybear)

    Michael, Thanks!
    Changed the line in function validate_username( $username ) in wp-includes/registration.php, around line 25 for WP 2.2
    from:
    if ( $name != $username )
    to:
    if (($name != $username) || (strlen($username) > 10))
    It works.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘limiting username length’ is closed to new replies.