Hi Brajesh, I used your snippet for hiding Members directory except for admin users, which i found on one of the forums. Is there any similar snippet to hide the members directory in the groups also, or can it be set individually for groups?
thanks,
VivekHi Vivek,
Thank you for the question. We can certainly do that.Question:- What will happen when a user clicks on “members” tab in group? should we remove the member tab completely there or hide the entries?
Doing it per group will need me to add settings. For now, Let us keep it simple and we can add settings later.
Regards
BrajeshThanks, Brajesh. I suppose it would be better to hide the members tab.
I understand having a group-wise setting would be more complex, so would it be possible to allow group directory visibility only to group admins and moderators?
thanks,
VivekHi Vivek,
Thank you.Please use this snippet in your bp-custom.php
/** * Hide Group members for everyone except Site Admin, Group admin and group mods. */ function buddydev_custom_disable_group_members() { if ( ! bp_is_group() ) { return; } $group_id = bp_get_current_group_id(); $user_id = get_current_user_id(); if ( is_super_admin() || groups_is_user_admin( $user_id, $group_id ) || groups_is_user_mod( $user_id, $group_id ) ) { return; } bp_core_remove_subnav_item( groups_get_current_group()->slug, 'members' ); } add_action( 'groups_setup_nav', 'buddydev_custom_disable_group_members' );
Regards
Brajesh
The topic ‘ [Resolved] Hide Members directory in Groups’ is closed to new replies.