Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hide Required BuddyPress Name Field


  • Julian
    Participant

    @julian12

    Hi there,

    I’ve been doing a lot of research into hiding the required name profile field (since my users find it redundant and confusing), however, I can’t seem to find an answer on any topics.

    The closest I stumbled upon was this BuddyPress ticket which gives this CSS code:

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

    to hide the name field and this javascript:

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

    to automatically populate the Name field with their BuddyPress username upon registration. However, I don’t know where or how I should implement the javascript section. Any ideas?

    Thank you for your help 🙂

    Julian

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

  • Henry Wright
    Moderator

    @henrywright

    You have 2 options. I’d recommend the 2nd:

    1: Copy and paste the JavaScript to your my-theme/buddypress/members/register.php template. In this case you’ll need to copy the <script> tags also.
    2: Create a separate file (my-theme/js/script.js for example) and paste the JavaScript into that. In this case you don’t need to copy the <script> tags. If you go down this route you will need to enqueue the script. See this article for info on how to do that:

    wp_enqueue_script()


    Julian
    Participant

    @julian12

    Hey Henry,

    Thank you so much! That worked perfectly.

    I forgot to mention though that the “Name” profile field still shows up on theer BuddyPress profile page. Do you know any code that I could use to hide that field?

    Thanks so much


    Julian
    Participant

    @julian12

    haha, never mind 🙂 I totally forgot about .profile .field_1 { display:none; } until now. I just threw it in my child theme’s custom css.

    Thanks for everything.

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