Skip to content

Instantly share code, notes, and snippets.

@dcavins
Created November 16, 2016 15:52
Show Gist options
  • Save dcavins/5e6ef39d1ffac33ee450e55afde68a3f to your computer and use it in GitHub Desktop.
Save dcavins/5e6ef39d1ffac33ee450e55afde68a3f to your computer and use it in GitHub Desktop.
Fix for allowing competing comment access settings to coexist peaceably.
diff --git includes/templates/docs/single/comments.php includes/templates/docs/single/comments.php
index b11ff29..8b5d42d 100644
--- includes/templates/docs/single/comments.php
+++ includes/templates/docs/single/comments.php
@@ -21,35 +21,44 @@ foreach ( (array)$comments as $comment ) {
?>
-<?php if ( current_user_can( 'bp_docs_read_comments' ) ) : ?>
+<?php if ( current_user_can( 'bp_docs_read_comments' ) || current_user_can( 'bp_docs_post_comments' ) ) : ?>
<div id="comments" class="comments-area">
- <h3>
- <?php printf( __( 'Discussion (%d)', 'bp-docs' ), $num_comments ) ?>
- </h3>
+ <?php if ( current_user_can( 'bp_docs_read_comments' ) ) : ?>
+ <h3>
+ <?php printf( __( 'Discussion (%d)', 'bp-docs' ), $num_comments ) ?>
+ </h3>
- <?php do_action( 'bp_before_blog_comment_list' ) ?>
+ <?php do_action( 'bp_before_blog_comment_list' ) ?>
- <?php if ( have_comments() ) : ?>
+ <?php if ( have_comments() ) : ?>
- <ol class="commentlist">
- <?php bp_docs_list_comments() ?>
- </ol><!-- .comment-list -->
+ <ol class="commentlist">
+ <?php bp_docs_list_comments() ?>
+ </ol><!-- .comment-list -->
- <?php do_action( 'bp_after_blog_comment_list' ) ?>
+ <?php do_action( 'bp_after_blog_comment_list' ) ?>
+
+ <?php if ( get_option( 'page_comments' ) ) : ?>
+ <div class="comment-navigation paged-navigation">
+ <?php paginate_comments_links() ?>
+ </div>
+ <?php endif; ?>
+
+ <?php else : ?>
+
+ <p class="comments-closed comments-empty">
+ <?php _e( 'There are no comments for this doc yet.', 'bp-docs' ) ?>
+ </p>
- <?php if ( get_option( 'page_comments' ) ) : ?>
- <div class="comment-navigation paged-navigation">
- <?php paginate_comments_links() ?>
- </div>
<?php endif; ?>
<?php else : ?>
- <p class="comments-closed comments-empty">
- <?php _e( 'There are no comments for this doc yet.', 'bp-docs' ) ?>
+ <p class="comments-closed comment-display-disabled">
+ <?php _e( 'Comment display has been disabled on this doc.', 'bp-docs' ) ?>
</p>
- <?php endif ?>
+ <?php endif; ?>
<?php if ( current_user_can( 'bp_docs_post_comments' ) ) : ?>
<?php comment_form( array(), get_the_ID() ) ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment