Deny usernames with SPACE character when registering (6 posts)

  1. filiped
    Posted 7 years ago #


    I'm integrating my wordpress login with a mIRC client.

    Since IRC does not support space characters or any other special characters at names, I would like to know:

    How to prevent user to create accounts with spaces and special characters in their usernames?

    Best regards.

    Filipe Deschamps

  2. filiped
    Posted 7 years ago #

    Aw guys, no idea? :)

  3. filiped
    Posted 6 years ago #


  4. ravisarma
    Posted 6 years ago #

    I am just guessing here, so please use caution:

    In wp-includes/formatting.php is a function sanitize_user() -- perhaps that's the place you should start looking. That the file is named formatting.php gives me pause... perhaps the class WP_User is where you should add your code. If you are not PHP proficient, you can ping me, and I can try to figure out the exact spot to add relevant code.

    Also, have you checked to see if a plug-in already exists that implements this?

  5. filiped
    Posted 6 years ago #


    Unfortunately, there's no plugins to prevent space character in usernames.

    I have some knowledge with php, but I'm to scared to mess up with core files due to upgrading problems.

    I still couldn't find a solution for this.

  6. vtxyzzy
    Posted 6 years ago #

    In the Plugin API/Filter Reference, you will find a brief mention of pre_user_login that is applied to a user login before saving in the DB. Perhaps you can use that to screen out special characters.

Topic Closed

This topic has been closed to new replies.

About this Topic