From 06af3e60e5e7897bf033a4d58556199f0fad396a Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 19 Sep 2005 15:11:05 +0000 Subject: - Patch #29866 by Florian, Uwe: made the recent comments block only show comments on public nodes. --- modules/comment.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/comment.module') diff --git a/modules/comment.module b/modules/comment.module index d441bd6d9..061bbae55 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -167,7 +167,7 @@ function comment_block($op = 'list', $delta = 0) { return $blocks; } else if ($op == 'view' && user_access('access comments')) { - $result = db_query_range(db_rewrite_sql('SELECT c.nid, c.* FROM {comments} c WHERE c.status = %d ORDER BY c.timestamp DESC', 'c'), COMMENT_PUBLISHED, 0, 10); + $result = db_query_range(db_rewrite_sql('SELECT c.nid, c.* FROM {comments} c INNER JOIN {node} n ON n.nid = c.nid WHERE n.status = 1 AND c.status = %d ORDER BY c.timestamp DESC', 'c'), COMMENT_PUBLISHED, 0, 10); $items = array(); while ($comment = db_fetch_object($result)) { $items[] = l($comment->subject, 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid) .'
'. t('%time ago', array('%time' => format_interval(time() - $comment->timestamp))); -- cgit v1.2.3