Skip to:
Content
Pages
Categories
Search
Top
Bottom

Username problems


  • Tom
    Participant

    @zenimot

    So I did some tests…
    In a standard WordPress install users can enter spaces in their username.
    No problem.
    E.g. ‘Firstname Surname’ renders as just that, with a space between the words.

    But when I activate BuddyPress (no other plugins) with the Twenty Fifteen theme, suddenly the spaces are removed from the username. Without as much as a single notification or error message.
    E.g. ‘Firstname Surname’ becomes ‘FirstnameSurname’.

    This is a huge problem for users! As they don’t get a message their input has been changed. And the username is not mentioned in the activation e-mail.

    In my opinion there are two solutions:
    1. notify the user of the change during registration;
    2. allow the same username entry specification as WordPress does.

    So far I haven’t found any of these solutions. 🙁

    Need help.

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

  • Tom
    Participant

    @zenimot

    BTW: I managed to edit the activation e-mail to include the username. But still no good solution.


    Henry Wright
    Moderator

    @henrywright

    Hi @zenimot

    See 5185 for some background and a discussion on the topic.


    Tom
    Participant

    @zenimot

    Thanks.
    Still can’t believe no warning is shown. Strange.

    But fixed it by editing the input field, so only letters and numbers are possible to type.
    And a message above the field.
    Nasty workaround…


    Henry Wright
    Moderator

    @henrywright

    @zenimot

    If you wanted to, you could disallow spaces in usernames by validating the field during registration. This is how you’d do it:

    function zenimot_validate_username() {
    
        $bp = buddypress();
    
        if ( strpos( $_POST['signup_username'], ' ' ) !== false ) {
            $bp->signup->errors['signup_username'] = __( 'Spaces are not allowed', 'buddypress' );
        }
    }
    add_action( 'bp_signup_pre_validate', 'zenimot_validate_username' );

    billreefer
    Participant

    @billreefer

    I added that snip to the bottom of the PLUGIN bbpress.php, NOT the THEME functions.php

    I am going to scrounge to see how I can add that warning to the top of the page in the welcome.


    billreefer
    Participant

    @billreefer

    I think it’s better to give registrants and newbies a break by warning them to not use spaces BEFORE they try first to register instead of frustrating them ‘neener neener’ after they do it wrong (don’t ya think?)

    at wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/activity/index.php

    at line 46 then and 66 I added the following 2 edits in bold

    /** This action is documented in bp-templates/bp-legacy/buddypress/activity/index.php */
    do_action( ‘template_notices’ ); ?>

    <p><?php _e( ‘Registering for this site is easy. Just fill in the fields below, and we\’ll get a new account set up for you in no time. NO-SPACES-ALLOWED-IN-USER-NAMES. If you have an EXISTING ACCOUNT try logging in with Username (one-word) instead of User Name‘, ‘buddypress’ ); ?></p>

    <?php

    /**
    * Fires before the display of member registration account details fields.
    *
    * @since BuddyPress (1.1.0)
    */
    do_action( ‘bp_before_account_details_fields’ ); ?>

    <div class=”register-section” id=”basic-details-section”>

    <?php /***** Basic Account Details ******/ ?>

    <h4><?php _e( ‘Account Details’, ‘buddypress’ ); ?></h4>

    <label for=”signup_username”><?php _e( ‘Username NO SPACES‘, ‘buddypress’ ); ?> <?php _e( ‘(required)’, ‘buddypress’ ); ?></label>
    <?php

    `
    Edit as you wish

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Username problems’ is closed to new replies.
Skip to toolbar