diff options
Diffstat (limited to 'modules/comment')
-rw-r--r-- | modules/comment/comment.module | 18 | ||||
-rw-r--r-- | modules/comment/comment.pages.inc | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module index c8573d7c0..4730dc0a3 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -370,16 +370,16 @@ function comment_new_page_count($num_comments, $new_replies, $node) { else { // Threaded comments. // Find the first thread with a new comment. - $result = db_query_range('(SELECT thread - FROM {comments} - WHERE nid = :nid - AND status = 0 - ORDER BY timestamp DESC) + $result = db_query_range('(SELECT thread + FROM {comments} + WHERE nid = :nid + AND status = 0 + ORDER BY timestamp DESC) ORDER BY SUBSTRING(thread, 1, (LENGTH(thread) - 1))', array(':nid' => $node->nid), 0, $new_replies) ->fetchField(); $thread = substr($result, 0, -1); $count = db_query('SELECT COUNT(*) FROM {comments} WHERE nid = :nid AND status = 0 AND SUBSTRING(thread, 1, (LENGTH(thread) - 1)) < :thread', array( - ':nid' => $node->nid, + ':nid' => $node->nid, ':thread' => $thread)) ->fetchField(); $pageno = $count / $comments_per_page; @@ -763,7 +763,7 @@ function comment_save($edit) { $parent->thread = (string) rtrim((string) $parent->thread, '/'); // Get the max value in *this* thread. $max = db_query("SELECT MAX(thread) FROM {comments} WHERE thread LIKE :thread AND nid = :nid", array( - ':thread' => $parent->thread .'.%', + ':thread' => $parent->thread .'.%', ':nid' => $edit['nid'])) ->fetchField(); @@ -1006,7 +1006,7 @@ function comment_render($node, $cid = 0) { } } else { - + //TODO Convert to dynamic queries once the pager query is updated to the new DBTNG API. // Multiple comment view. @@ -1150,7 +1150,7 @@ function comment_num_replies($pid) { if (!isset($cache[$pid])) { $cache[$pid] = db_query('SELECT COUNT(cid) FROM {comments} WHERE pid = :pid AND status = :status', array( - ':pid' => $pid, + ':pid' => $pid, ':status' => COMMENT_PUBLISHED)) ->fetchField(); } diff --git a/modules/comment/comment.pages.inc b/modules/comment/comment.pages.inc index d1a3026fd..cc2913520 100644 --- a/modules/comment/comment.pages.inc +++ b/modules/comment/comment.pages.inc @@ -70,7 +70,7 @@ function comment_reply($node, $pid = NULL) { if ($pid) { // Load the comment whose cid = $pid $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array( - ':cid'=>$pid, + ':cid'=>$pid, ':status'=>COMMENT_PUBLISHED))->fetchObject(); if ( $comment ) { // If that comment exists, make sure that the current comment and the |