• pjbursnall

    (@pjbursnall)


    I’ve noticed on a few test sites I have setup (with varying plugins) that WP does not allow spaces in a username – but this is not notified during the registration page, is not prompted for correction during registration, and is not notified to the new user via email.

    So you can register with a space in your username but you’ll never be able to sign in with it.

    Seems like a bit of a flaw to me?

    Any ideas on correcting this on existing installs would be welcome.

    Thanks,
    Paul.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Tom Leger

    (@tomleger)

    Hi Paul,

    WordPress does actually allow spaces in the username–as an admin you can go in and manually set a password and log in with that account. But, I am seeing that the registration emails aren’t going through to that user (or the password reset emails, etc).

    I’m guessing that the space is breaking the function. Seems like a definite problem!

    Here’s the codex for the function wp_new_user_notification:
    https://codex.www.ads-software.com/Function_Reference/wp_new_user_notification

    Here’s a plugin that will disallow usernames with various characteristics of your choosing, including spaces: https://www.ads-software.com/plugins/restrict-usernames/

    Thread Starter pjbursnall

    (@pjbursnall)

    Hi Tom,

    Like I say, I don’t see any error telling the space isn’t permitted, but WP automatically adds a hyphen in it’s place – something a normal user would never know. Registration emails seem fine when I’ve tested this. WP is really appending the username without notification.

    I’ll look at restricting characters I guess. Hopefully someone will pick this up in the next release.

    Thanks again,
    Paul.

    Clayton James

    (@claytonjames)

    I just registered a new user on one of my sites (3.7.1) using a name containing a space, and had no issues logging in with that user name. The email was also sent successfully, and the username and password in it were exactly as expected. Weird.

    Tom Leger

    (@tomleger)

    Weird! I’m going to try to track down why that might be happening on my end. I did install a logging plugin to check to see if the mail was being sent, and it is. It’s definitely not showing up in my email, either in the inbox or in spam, etc.

    Thread Starter pjbursnall

    (@pjbursnall)

    I’ve been able to replicate my issue – the hyphen is only added in place of white space on a username when Buddypress is activated, and therefore handling the registration process.

    I have raised a ticket on the BP forum – https://buddypress.org/support/topic/whitespace-in-username/

    I’m not sure what’s going on with your registration emails Tom?

    Paul.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Notify of username restrictions’ is closed to new replies.