diff --git a/includes/integration-groups.php b/includes/integration-groups.php index bcabc763..c2ff0ac7 100644 --- a/includes/integration-groups.php +++ b/includes/integration-groups.php @@ -1308,27 +1308,27 @@ function admin_markup() { * @since 1.0-beta */ function enable_nav_item() { - global $bp; - $enable_nav_item = false; $this->settings = bp_docs_get_group_settings( $this->group_id ); $this->group_enable = ! empty( $this->settings['group-enable'] ) ? true : false; + $current_group = groups_get_current_group(); // The nav item should only be enabled when BP Docs is enabled for the group if ( $this->group_enable ) { - if ( !empty( $bp->groups->current_group->status ) && $status = $bp->groups->current_group->status ) { + if ( ! empty( $current_group->status ) && $status = $current_group->status ) { // Docs in public groups are publicly viewable. if ( 'public' == $status ) { $enable_nav_item = true; - } else if ( groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) { + } else if ( groups_is_user_member( bp_loggedin_user_id(), $current_group->id ) ) { // Docs in private or hidden groups visible only to members $enable_nav_item = true; } } // Super admin override - if ( is_super_admin() ) + if ( is_super_admin() ) { $enable_nav_item = true; + } } return apply_filters( 'bp_docs_groups_enable_nav_item', $enable_nav_item );