Skip to:
Content
Pages
Categories
Search
Top
Bottom

Restrict access to the group members list

  • @prettyboyelias

    Participant

    Hi there,

    Could you please help to restrict access to the group members list?

    So only admin would be able to see these pages. Because we don’t want our users to know how many users are within each group on the website.

    For that we need to restrict all similar pages:

    /groups/GROUPNAME/members/
    /groups/GROUPNAME/members/all-members/

    I appreciate your help 😉

Viewing 3 replies - 1 through 3 (of 3 total)
  • @clickallco

    Participant

    Something like this should work

    function remove_group_member_nav_item() {  
    
    	if ( ! bp_is_group() || is_super_admin() ) {
    		return;
    	}
    
    	$slug = bp_get_current_group_slug();
    	bp_core_remove_subnav_item( $slug, 'members' );
    }
    add_action( 'bp_actions', 'remove_group_member_nav_item' );

    @prettyboyelias

    Participant

    Wow, clickallco, thanks for the quick help! I really appreciate your help ????

    This code removes the “members” tab and access to the /groups/GROUPNAME/members/ page.

    But in my theme (buddyboss) when you click on the group it redirects to this page /groups/GROUPNAME/members/all-members/

    And that page is still available.

    Can I do anything about it? Ideally I need 2 things:

    1. Remove access to pages like /groups/GROUPNAME/members/all-members/
    2. If user open these 2 pages:
    /groups/GROUPNAME/members/
    /groups/GROUPNAME/members/all-members/

    Then redirect to the activity page:
    /groups/GROUPNAME/activity/

    @prettyboyelias

    Participant

    Sorry for the question marks, I tried to use emoji there 😉

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