diff --git a/wp-content/mu-plugins/openlab-group-document-privacy.php b/wp-content/mu-plugins/openlab-group-document-privacy.php
index 2242695f79..91369940c7 100644
--- a/wp-content/mu-plugins/openlab-group-document-privacy.php
+++ b/wp-content/mu-plugins/openlab-group-document-privacy.php
@@ -48,17 +48,37 @@ function cac_catch_group_doc_request() {
'redirect' => bp_get_root_domain(),
);
} else {
- if ( 'public' !== $group->status ) {
+ $doc_filename = $file_deets[1];
+ $document = new BP_Group_Documents();
+ $document->populate_by_file( $doc_filename );
+
+ $document_id = ! empty( $document->id ) ? $document->id : 0;
+
+ // First, check the file-specific privacy settings.
+ $group_privacy = groups_get_groupmeta( $group->id, 'group_document_privacy_settings' );
+ $doc_privacy = isset( $group_privacy[ $document_id ] ) ? $group_privacy[ $document_id ] : 'public';
+
+ $user_can_download = true;
+
+ if ( 'admins' === $doc_privacy ) {
+ $user_can_download = groups_is_user_admin( bp_loggedin_user_id(), $group_id );
+ } elseif ( 'members' === $doc_privacy ) {
+ $user_can_download = groups_is_user_member( bp_loggedin_user_id(), $group_id );
+ } elseif ( 'public' !== $group->status ) {
// If the group is not public, then the user must be logged in and
// a member of the group to download the document
if ( ! is_user_logged_in() || ! groups_is_user_member( bp_loggedin_user_id(), $group_id ) ) {
- $error = array(
- 'message' => sprintf( 'You must be a logged-in member of the group %s to access this document. If you are a member of the group, please log into the site and try again.', $group->name ),
- 'redirect' => bp_get_group_permalink( $group ),
- );
+ $user_can_download = false;
}
}
+ if ( ! $user_can_download ) {
+ $error = array(
+ 'message' => sprintf( 'You must be a logged-in member of the group %s to access this document. If you are a member of the group, please log into the site and try again.', $group->name ),
+ 'redirect' => bp_get_group_permalink( $group ),
+ );
+ }
+
// If we have gotten this far without an error, then the download can go through
if ( ! $error ) {
$doc_path = BP_GROUP_DOCUMENTS_SECURE_PATH . $doc_id;
diff --git a/wp-content/plugins/wds-citytech/wds-citytech-bp.php b/wp-content/plugins/wds-citytech/wds-citytech-bp.php
index 37e1ae813f..0a2c18149e 100644
--- a/wp-content/plugins/wds-citytech/wds-citytech-bp.php
+++ b/wp-content/plugins/wds-citytech/wds-citytech-bp.php
@@ -456,20 +456,6 @@ function openlab_remove_sitewide_notices() {
}
add_action( 'wp_footer', 'openlab_remove_sitewide_notices' );
-/**
- * Force BP Docs to have comments open
- *
- * I guess old ones get closed automatically
- */
-function openlab_force_doc_comments_open( $open, $post_id ) {
- $_post = get_post( $post_id );
- if ( 'bp_doc' === $_post->post_type ) {
- $open = true;
- }
- return $open;
-}
-add_action( 'comments_open', 'openlab_force_doc_comments_open', 10, 2 );
-
/**
* Markup for the 'A member has joined a public group for which you are an admin' setting.
*/
diff --git a/wp-content/themes/openlab/docs/single/comments.php b/wp-content/themes/openlab/docs/single/comments.php
index 464a17cd3e..0160d5c0d1 100644
--- a/wp-content/themes/openlab/docs/single/comments.php
+++ b/wp-content/themes/openlab/docs/single/comments.php
@@ -6,22 +6,27 @@
$comments_by_type = &separate_comments( $comments );
if ( ! empty($comments_by_type['comment']) ) :
-?>
-
+
+
+
- -
-