restrict non-group-members from visiting tabs from buddypress groups

I want to hide some specific group page tabs from the non-group members of the site (i.e. registered site user but not the group member).

I know that group tabs can be removed like that:

Read More
function remove_group_options() {
    global $bp;

    bp_core_remove_subnav_item($bp->groups->slug, 'members');
    bp_core_remove_subnav_item($bp->groups->slug, 'send-invites');

}
add_action( 'bp_setup_nav', 'remove_group_options' );

or even can be easily hidden from css (by using display:none ). But what I want is to allowing only group members to be able to view specific tabs (say forums, members etc.) and not others.

Please someone help me in that issue.

** To be very clear I dont want to block any custom page or post… I only want to block Inbuilt buddypress tabs from all non-group members (let it be registered user or not).

Related posts

Leave a Reply