summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-01-31 16:19:29 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-01-31 16:19:29 +0000
commitb1d7222c6b003490dda7f45a92fe80737ba1c129 (patch)
tree85b62485c3bb54248fa2d7725ad376884fd752fd /modules/comment/comment.module
parent6cbf7424a0c40228ec06428ef201039bd1ffbe72 (diff)
downloadbrdo-b1d7222c6b003490dda7f45a92fe80737ba1c129.tar.gz
brdo-b1d7222c6b003490dda7f45a92fe80737ba1c129.tar.bz2
#352337 by catch: Avoid pager query if there are no comments on a node.
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index a69fba641..4983ca7db 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1078,10 +1078,12 @@ function comment_render($node, $cid = 0) {
$output .= theme('comment_view', $comment, $node, $links);
}
}
- // Only attempt to render comments if the node has been commented upon.
- else {
+ // Only attempt to render comments if the node has visible comments.
+ // Unpublished comments are not included in $node->comment_count, so show
+ // comments unconditionally if the user is an administrator.
+ elseif ($node->comment_count || user_access('administer comments')) {
- //TODO Convert to dynamic queries once the pager query is updated to the new DBTNG API.
+ // TODO: Convert to dynamic queries once the pager query is updated to the new DBTNG API.
// Multiple comment view.
$query_count = 'SELECT COUNT(*) FROM {comment} c WHERE c.nid = %d';