• rlowden

    (@rlowden)


    We would like to allow users to have spaces in their user names. When registering, spaces are being automatically removed preventing new users from registering on our website, http://www.linkglobalbiz.com. I am not a programmer. Any help would be appreciated.

    We have read the threads that say you can’t have blank spaces in the user name because of creating bad URLs. In the same posts we found where it was stated that you can have balnk spaces in user names, but their was no solution offered.

    Any help would be greatley appreicated.

Viewing 9 replies - 1 through 9 (of 9 total)
  • kmessinger

    (@kmessinger)

    http://ux.stackexchange.com/questions/79950/what-are-some-compelling-reasons-to-disallow-spaces-in-usernames

    and scroll down to “There are a few reasons not to allow spaces in usernames…”

    Thread Starter rlowden

    (@rlowden)

    I read the above article before. We want to add spaces.

    Moderator Samuel Wood (Otto)

    (@otto42)

    ww.wp.xz.cn Admin

    There’s no changes that you need to make. WordPress does allow spaces in usernames.

    In multisite instances, spaces are not allowed, for a very good reason. This cannot be changed. However, in normal single site instances, spaces are accepted in usernames just fine.

    Thread Starter rlowden

    (@rlowden)

    We do have buddypress. It does not allow spaces.

    If you are not on multisite, You will need to enable username compatibility for BuddyPress.
    Put the following code in bp-custom.php

    define( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE', true );

    For more details, Please see
    https://codex.buddypress.org/getting-started/customizing/changing-internal-configuration-settings/

    Thread Starter rlowden

    (@rlowden)

    Thank you. I will give it a try.

    Thread Starter rlowden

    (@rlowden)

    I added a file bp-custom.php with the code to the wp-content/plugin. New users registering still cannot add spaces.

    Hi,
    Just to be sure, I tested again.

    1. At the moment, It is going to be real difficult to allow space. BuddyPress strips out the space on line 1792 bp-members-functions.php

    $user_login     = preg_replace( '/\s+/', '', sanitize_user( $user_login, true ) );

    And there is no way to avoid it at the moment. No filter available there.

    My previous suggestion will help only in making the profiles available when they contain dot or spaces not in registering them.

    A temporary solution may be to filter on ‘bp_after_bp_core_signups_add_args_parse_args’ and change the value of ‘user_login’ if $_POST[‘signup_username’] is set and valid( See BP_Signup::add() ). That is a hack that will most probably work but is too ugly for my taste.

    Thread Starter rlowden

    (@rlowden)

    if it is too ugly then I will not take the chance! Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Allow spaces in usernames’ is closed to new replies.