Skip to:

Registering username with space can’t sign up

  • Tanya


    When signing up for the first time, user can choose a username, e.g. Future Diamond. But when you activate and log in, Future Diamond cannot be the username. I realised that the username was changed to Future-Diamond in the process (hyphen instead of space), and that is the username you have to use.

    How do I change it so that a username with spaces work?

    Using WordPress 3.4.1, Buddypress 1.6.1 with BBP-Template-Pack at
    If you want to try and register, go to

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

  • Tammie Lister


    As far as I know you can’t have spaces in the usernames – that’s a limitation of the registration script.



    I’ve tried it again and I am using the original buddypress registration.php – usernames with spaces are still allowed.

    Does anyone else’s site allow them to a register a username with a space or is it just me? I do prefer it with a space because it looks nicer on the site.



    I am still having problems with the registration. I have activated the plugin “Restrict Usernames” by Scott Reilly, and ticked the box to prevent having spaces in usernames, but when registering usernames with spaces, registration continues to be allowed to go through.

    Can anyone help me with this please?



    I am still having trouble with this and it is driving me nuts!
    I have disabled the plugin “Restrict Usernames”, and have added this code to my functions.php file
    `add_filter(‘validate_username’ , ‘custom_validate_username’, 10, 2);
    function custom_validate_username($valid, $username ) {
    if (preg_match(“/\s/”, $username)) {
    // there are spaces
    return $valid=false;
    return $valid;
    And still, usernames with spaces are allowed through during registration.



    Was anybody able to fix this ?? I get the same error username are allowed with blank spaces which then are transformed in hyphens without notifying the user.



    Hey! for BP 6.1 :
    Lous thinking!
    Working on the same problem. Maybe try this advice. The problem is; you cant send private not-friend-messages or mentions or scale up to blog-user-based systems with whitepaced usernames. In the end the user gonna need to enter no-whitepace-names. So interacting nicely would be better approach:

    1) To accept the user to type whitespace, but not record them, using jQuery
    2) Use EMAIL also to login

    Example for 1) :

    – Leave the register process AS IT IS in bp 6.1 -as now accepts:

    Donald Duck = donAld duCK = or HOWEVER a user choose their username with lowercase/ uppercase (This is good for loggin back in – many forgot their cases). The username avabililty checker don alows any other combinations either by default (DonaLD-DUCK is occupied).

    – Run a jQuery on(‘keyup’) function as a validator when form appears at :

    a) register
    b) Loggin in
    c) Changing username (if enabled by any plugin)
    d)* Display name (xprofile required field) = profile edit BASE submit

    OBS : The keyup replaces any whitepsace on the fly when user typing in their Username with hyphens. Diffrent browser handle this diffrent, so a onfocus need to be provided if user PASTE their name. NOTE : YES The user with no javascript has to look at the instructions instead …

    The results will become : “Donald-Duck” as username, loggin in however letters cased.

    If you don wanna show this white-space replacement, Use ‘onsubmit’ instead of keyup -so it can be added silent. But I think its better to LEARN the user to use Hypens – by see the “forced action”. The user will need to write correct usernames when sending/ composing messages and mentions and feeds and…if you scale up.

    GOOD: “donald-duck” as the sitewide username = key (private messages, mentions and slugs for blogfarms etc etc)

    Also – for user exp – Use a tooltip to make it CLEAR that we are replacing their favorite username with hyphens.

    * Display name field, change in the template to ‘hidden’ in xprofile situations. Menaing: NEVER let the user be avaible to fill that out. So the trick comes to the register process. This field is hardcoded required. Let the field be hidden by CSS, added a clone of Username field in the submit. Let the username be Masterfield so avabililty check running ok. Then you get rid of Display name showing SAME for diffrent users – if they can type by themselfs.

    Special if you dont wanna display/ using First and Last names:

    I have hidden the Display name field in register/ everywhere, cloning username data on Submit, splitting hypens so it displays Donald Duck.

    In the payment forms Firstname = Donald Last name = Duck
    OTHERWISE the first name will be Donald-Duck and last name Empty.


    Don mess with php tweaks so urls get crazy, you loose quality of your collected database if ya cant scale up or migrate in the future. I tried everything and belive me, a small site will starting have problems very soon. Don core files, its security reasons why no filtering is easy to do here – I suppose, after trying everything with authenticate filters and hooks.

    I woluld like a plugin to Change ALL custom messages provided in the sign up processes in WP. Including The boring email without username provided. The Welcome Pack can do this with some trix. So the user-name is shown in confirm message.

    / Hope it helps.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Registering username with space can’t sign up’ is closed to new replies.
Skip to toolbar