• Resolved Dr. Flow

    (@wtsadmin)


    I lost a day and a half bewildered at why some customers could not log in. Turns out WordPress isn’t allowing spaces in a username, yet an account created through checkout will allow spaces in a username.

    In other words if a WooCommerce created account has a space in the username they will login and see the second login prompt on account pages, yet not be able to login.

    Rather than filter usernames to remove spaces I would recommend throwing an error if a user choses a username with a space.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @wtsadmin,

    Sorry to hear about the trouble that you’ve run into. WooCommerce does not alter the requirements for usernames in WordPress. By default, WordPress user names can have spaces in them and WooCommerce allows that too.

    It sounds like something may be modifying that behavior on the site. It could be a plugin, theme or some custom code. You could do a conflict test by disabling everything but WooCommerce and switching to the Twenty Nineteen theme and registering using spaces. If it works, keep testing while activating the plugins again. When it stops working, the last item activated is likely the problem.

    Let us know what you find out and we’ll go from there.

    Cheers

    Thread Starter Dr. Flow

    (@wtsadmin)

    Thanks for the reply. I hope this thread is of use to others.

    Fresh install. Only plugin active WooCommerce. Storefront theme. The issue occurs when there is a space in the username. Strange because WC doesn’t handle login yet a user with a space can’t login.

    My solution was to add the plugin Restrict Usernames Emails Characters and limit spaces. If an error is thrown it does so through WP so the alert appears the same as a WC error.

    @wtsadmin the problem you are experiencing, in which WordPress usernames with spaces cannot login, is almost certainly due to a bug introduced in PHP 7.4.2.

    See:

    The immediate workaround is to downgrade to PHP 7.4.1 and then upgrade to PHP 7.4.3 once it has been released.

    • This reply was modified 5 years ago by Vlad Lasky.
    Thread Starter Dr. Flow

    (@wtsadmin)

    My suspicion as well Vlad because nothing should have changed with WP. Let us hope it is resolved with a more modern PHP release. Right now I’m using 7.4.

    Assuming this is the case the problem will soon take care of itself, yet hopefully it doesn’t wreak havoc with others who may have users with spaces in their login.

    This post saved my day. Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cannot login with spaces in username’ is closed to new replies.