Skip to:
Content
Pages
Categories
Search
Top
Bottom

usernames registration with spaces on multisite install


  • ahmedselim
    Participant

    @ahmedselim

    I have a multisite wp install with buddy press and I am seeing the following behavior.

    If someone registers and puts a space in the username i.e. john doe, the username is changed by wp to johndoe, (it is my understanding that this is done by wordpress) The issue that it is not really highlighted to the user, so if they don’t pay close attention to the username and try to enter the username that they entered (with the space) they will get an invalid username message..

    My question is this, is there a way to notify the user during registration (they receive a confirmation email but honestly i don’t think they will read it close enough to realize the change in username) that the username with the space is not acceptable? maybe to add some king of validation or error message when a space is entered in the username field?

    I have tried several plugins that would restrict usernames without any success so though maybe I could approach this at the registration form itself.

    I am running WP 3.4.2 and buddy press 1.6.1

    Any help would be greatly appreciated

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

  • @mercime
    Participant

    @mercime


    ahmedselim
    Participant

    @ahmedselim

    @mercime I have tried that plugin but it doesn’t seem to be working I am not sure if it is a compatibility issue with WP, but have posted on the restrict-usernames plugin support and am awaiting a response. I just though that maybe going the route of the registration form may be another option if it is even possible..


    @mercime
    Participant

    @mercime

    Scott, the plugin author of restrict usernames, is a top-notch developer and I’ve used the plugin successfully in my sites. The plugin is compatible with BuddyPress. Could be conflict with another plugin and/or with theme, there are just so many variables. Have you tried deactivating other plugins except BuddyPress to test restrict usernames plugin?


    ahmedselim
    Participant

    @ahmedselim

    @mercime I just tried deactivating all other plugins and reverted to all the default themes with the same outcome. I am not questioning the quality of the plugin whatsoever as I have heard many people using the plugin without issue.. but I am not sure what the issue that I am seeing may be.

    Also i noticed on the plugin page that some others were asking about the compatibility with 3.4.2 so I am not sure if maybe someone else may be seeing the same issue that I am.


    Tim Hyde
    Participant

    @livingos

    We used some javascript to automatically convert spaces as user types!

    `// sanitize signup field
    jQuery(“#signup_username”).keyup(function(){
    this.value = this.value.toLowerCase().replace(/ /g, ‘-‘);
    }); `


    redknite
    Participant

    @redknite

    where did you put this code?


    bp-help
    Participant

    @bphelp

    Use this code in your themes functions.php or bp-custom.php courtesy of @sbrajesh:
    `
    /**
    * BuddyPress replaces the space with ‘-‘ which is not known to the user
    * We remove the attached function to stop BP from circumventing the space in username
    */
    add_action(‘bp_loaded’,’bpdev_remove_bp_pre_user_login_action’);
    function bpdev_remove_bp_pre_user_login_action(){
    remove_action( ‘pre_user_login’, ‘bp_core_strip_username_spaces’ );
    }

    //add a filter to invalidate a username with spaces
    add_filter(‘validate_username’,’bpdev_restrict_space_in_username’,10,2);
    function bpdev_restrict_space_in_username($valid,$user_name){
    //check if there is an space
    if ( preg_match(‘/\s/’,$user_name) )
    return false;//if myes, then we say it is an error
    return $valid;//otherwise return the actual validity
    }
    `


    redknite
    Participant

    @redknite

    Thanks for the reply bphelp. i placed this code into my functions.php and nothing changed… and i don’t have the bp-custom.php. Do you have any other suggestions?

    Thanks again!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘usernames registration with spaces on multisite install’ is closed to new replies.
Skip to toolbar