Skip to content

Commit

Permalink
Don't show nav items in private groups to non-members.
Browse files Browse the repository at this point in the history
  • Loading branch information
boonebgorges committed Jul 28, 2020
1 parent 4907bce commit 9acb128
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public function add_library_nav_item() {

$group = groups_get_current_group();

$user_has_access = current_user_can( 'bp_moderate' ) || 'public' === $group->status || groups_is_user_member( bp_loggedin_user_id(), $group->id );

bp_core_new_subnav_item(
array(
'slug' => cac_group_library()->get_prop( 'nav_slug' ),
Expand All @@ -53,6 +55,7 @@ public function add_library_nav_item() {
'name' => 'Library',
'screen_function' => array( '\CAC\GroupLibrary\Screens\Library', 'panel' ),
'position' => 32,
'user_has_access' => $user_has_access,
),
'groups'
);
Expand Down

0 comments on commit 9acb128

Please sign in to comment.