From 514417eaf0c4e91d7460dafa14816f542c43f88d Mon Sep 17 00:00:00 2001 From: Boone B Gorges Date: Sat, 20 Jul 2024 17:21:44 -0500 Subject: [PATCH] Hide 'Add New File' elements for non-group-members. See cuny-academic-commons/commons-in-a-box#492. --- buddypress/groups/single/documents.php | 12 +++++++----- lib/menus.php | 7 +++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/buddypress/groups/single/documents.php b/buddypress/groups/single/documents.php index fc68aab..f4ab708 100644 --- a/buddypress/groups/single/documents.php +++ b/buddypress/groups/single/documents.php @@ -171,11 +171,13 @@ function ( $folder ) {

-
- operation ) { ?> - - -
+ +
+ operation ) { ?> + + +
+ diff --git a/lib/menus.php b/lib/menus.php index 9e74e77..4d844fa 100644 --- a/lib/menus.php +++ b/lib/menus.php @@ -436,10 +436,13 @@ function openlab_group_files_submenu() { $current_item = $base_url; $menu_list = [ - $base_url => __( 'All Files', 'commons-in-a-box' ), - $base_url . '?action=add_new_file' => __( 'Add New File', 'commons-in-a-box' ), + $base_url => __( 'All Files', 'commons-in-a-box' ), ]; + if ( current_user_can( 'bp_moderate' ) || groups_is_user_member( bp_loggedin_user_id(), groups_get_current_group()->id ) ) { + $menu_list[ $base_url . '?action=add_new_file' ] = __( 'Add New File', 'commons-in-a-box' ); + } + return openlab_submenu_gen( $menu_list, false, $current_item ); }