Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hide Members List in Public Groups


  • mlapl1
    Participant

    @mlapl1

    Hello

    How do I hide the membership list of a public group but keep the posts themselves public?

    I am using the latest WP and the latest BP (which I hardly know at all – just started).

    Thanks
    Andrew

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

  • shanebp
    Moderator

    @shanebp

    This will remove the ‘Members’ link on group pages:

    function bp_group_remove_members_tab() {
    	
        if ( ! bp_is_group() )
    	return; 
    	
        global $bp;
        if (isset($bp->groups->current_group->slug) && $bp->groups->current_group->slug == $bp->current_item) 	{
             $bp->bp_options_nav[$bp->groups->current_group->slug]['members'] = false;		 		 
        }
    }
    add_action( 'bp_setup_nav', 'bp_group_remove_members_tab', 999 );

    You can put it in your theme/functions.php
    also – I think there is probably a better way to code this… ?


    mlapl1
    Participant

    @mlapl1

    Thank you very much. Pity that the theme needs to be hacke as, presumably, this will have to be added every time the theme is updated – but it is a good start. Thanks again


    shanebp
    Moderator

    @shanebp

    Pity that the theme needs to be hacke as…

    To avoid that, you should be using a child theme.
    Or you could put the code in bp-custom.php.


    mlapl1
    Participant

    @mlapl1

    Oh good… so am I right in thinking that bp-custom.php is recognised bby bp and will be read if it is present? BTW… your code works just fine. Thank you!

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