Skip to:
Content
Pages
Categories
Search
Top
Bottom

required Username twice at Registration


  • nilje
    Participant

    @nilje

    Hi,

    At my registration page I have two required username fields. One for WordPress itself and one for buddypress I think. How can I set to just fill out the one for wordpress and set the same username for buddypress as well? It’s really confusing for the user to set the username twice.

    Thanks!

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

  • danbp
    Moderator

    @danbp

    You think right. BuddyPress need this field to sync with WordPress.
    It’s really confusing for the user to set the username twice.
    And what about entering password twice ?

    Read from here:
    https://buddypress.org/support/topic/hide-the-username-and-display-firstnamelastname/


    nilje
    Participant

    @nilje

    thanks… thats not really compareable, the double password entering is just for precaution.
    I’ve never seen anywhere to enter my username twice.. And what if they enter two different ones, they don’t know for sure with which one they could login. That’s just odd for everyone who don’t know it’s about WordPress and Buddypress.

    Your link couldn’t help me, the topics are about not using usernames at general, I need it, but not twice. I dont’t trust the Plugin Simplr Registration Form Plus+, sounds good but there are many who had problems with their databases after using it..


    modemlooper
    Moderator

    @modemlooper

    BuddyPress and WP do not have two usernames. Is this the BuddyPress registration form or another form by a plugin?


    nilje
    Participant

    @nilje

    No, there is no other plugin which could cause it
    I’ve made a screenshot
    http://www.danielaholl.de/Apublic/Unbenannt-1.jpg
    I think the left side is the WordPress registration and right the one for buddypress.. there are my custom profile fields too.


    modemlooper
    Moderator

    @modemlooper

    the column on the right are added profile fields, you can remove the field from the admin

    more info on profile fields https://codex.buddypress.org/administrator-guide/extended-profiles/


    nilje
    Participant

    @nilje

    yes, they’re not the problem… I want them there so they can already fill that out. The only thing is the required username.


    TheBarfly
    Participant

    @thebarfly

    I’ve the same issue, any solution for this ?


    sharmavishal
    Participant

    @sharmavishal

    Either u remove it as modemlooper suggested or use the following plugin

    https://wordpress.org/plugins/bp-xprofile-wp-user-sync/


    nilje
    Participant

    @nilje

    you can create a new group, put the required ‘not deletable’ topics into that new group (by drag and drop) and then delete this new group


    manm0untain
    Participant

    @manm0untain

    If you do that (create new group, drag username into new group then delete), the registration breaks down. So I wouldn’t recommend doing that.


    manm0untain
    Participant

    @manm0untain

    Extended Buddypress profile fields demands an additional name / username field. This is the case whether you are using Buddypress Usernames Only plugin or not.

    This is only relevant if you require extended profile fields. If you don’t, then go into Buddypress settings and turn off extended profiles. That will remove the requirement for a second name on the registration / profile area.

    If you want to use extended profile fields on BP, but you don’t want the second username / name field uglying up your registration flow, you can do the following.

    You have to be careful with this, because if you hack it, remove the second required name / username field, or any of a dozen other solutions I’ve found – the registration will break down. You will get 500 errors, missing confirmation emails etc.

    The solution I used for this is as follows.

    1. Assuming you just want to use a singular Username for your site – install the Buddypress Usernames Only plugin. It says the plugin is old but it is still working as of WP version 4.7.4 (for me at least). This deals with the display / access of various username / name / fullname / nickname issues throughout the WP / Buddypress install.

    2. Next you’ll need to hide the extra name / username field on the registration area, and the BP profile area. Stick this CSS into your theme custom CSS under Appearance > Customize:

    #profile-edit-form .field_1 { display: none;}
    #signup_form .field_1 { display: none;}

    (I have seen a 3rd line of CSS on other solutions – #register-page p { display: none;} – all this did for me was to hide the confirmation message after the user registers. You probably want that so I’d leave that line out).

    3. The fields should now be hidden, but the system still requires that information to process properly. So next create a file in notepad and save it as name_remove.js

    In that file put the following javascript:

    document.getElementById("signup_username").onchange = function() {myFunction()};
    function myFunction() {
     var x = document.getElementById("signup_username");
    document.getElementById("field_1") .value = x.value
    }

    Save that file and upload it to your theme folder (same folder as functions.php etc). This javascript automatically populates the hidden field with the username, so the system does not complain or fall over.

    4. Finally you need WordPress to pick this javascript file up. You can do that with a function, using file enqueing. Copy and paste this function into your themes functions.php file Appearance > Editor

    function wpb_adding_scripts() {
    wp_register_script('name_field_remove', get_stylesheet_directory_uri() . '/name_remove.js', array('jquery'),'1.1', true);
    wp_enqueue_script('name_field_remove');
    }
    
    add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );

    You have to be careful about the path. If it’s not working at this point, you can view the page source of your register page, and search for “name_remove.js” – look at the path on that script line. If the path is wrong, tweak it in the function above (you might need to change the get_stylesheet_directory_uri() part, or the path part after it. You can check if the path is correct by clicking the link to the .js file in the page source. If the path is wrong, you will get a 404 error. If the path is right, you should see the script code contained in the js file. Fiddle around with the path until it’s correct.

    At that point, you have hidden the fields with CSS, and populated the second hidden username / name field automatically with javascript. Test your registration / confirmation email etc to make sure everything is working. But you should be good to go.

    Hope that helps someone. Thanks to the folks I cobbled this solution together from.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.
Skip to toolbar