Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Hide BP Search Bar


  • paton400
    Participant

    @paton400

    Hey guys,

    I’m wondering if anyone can tell me how to go ahead hiding the search bar to users in the members page (or indeed any page).

    I have set up various links to search results (e.g. click here to see a list of…), but I would like to restrict users to those links and prevent them from searching other users or stumbling across another directory other than one I have set up.

    As these links I have set up are links to search results (e.g. mydomain/members/XPROFILE-FIELD) I don’t want to remove the search function altogether, just make the search bar invisible.

    Can anyone help?

    Cheers 🙂

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

  • danbp
    Moderator

    @danbp

    Hi @paton400,

    give this a try. You can the function to your child-theme’s functions.php or into bp-custom.php

    //Remove Buddypress members search 
    function bpfr_remove_member_search_form( $search_form_html){
        return '';
    }
    add_filter('bp_directory_members_search_form', 'bpfr_remove_member_search_form'  );

    paton400
    Participant

    @paton400

    Ah thank you, That worked prefect!

    Do you know how I can remove the total members counter as well (All Members)

    Regards


    danbp
    Moderator

    @danbp

    This filter will remove any members count everywhere. Goes into bp-custom.php or theme’s functions.php

    add_filter ('bp_get_total_member_count', '__return_false');

    Now you see a count with zero. But this count is hardcoded in a span. So you can hide this with css:

    #activity-all span, 
    #members-all span{
    	display:none;	
    }

    See html/css details in index.php of each folder in bp-templates/bp-legacy/buddypress/


    paton400
    Participant

    @paton400

    Thanks mate. I’ll give that a go.

    Regards


    paton400
    Participant

    @paton400

    Hi Danbp,

    I managed the first part no problem, but to so much with the second.

    I just pasted the following into each of the index.php folders in bp-templates/bp-legacy/buddypress/(activity, blogs, forums, groups and members)

    #activity-all span, 
    #members-all span{
    	display:none;	
    }

    Nothing seems to have happened. The counter still appears and displays zero.


    danbp
    Moderator

    @danbp

    Are you aware about css styling ?
    The css goes into your theme style.css, not in the core file.

    Please read a little the codex before asking for such basic things !
    Read about child-theme and buddypress customization. On BP’s codex and WP codex too.
    You can also learn a lot by only reading topics on this forum.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] Hide BP Search Bar’ is closed to new replies.
Skip to toolbar