--- modules/comment/views_handler_field_comment_link.original.inc 2008-09-10 03:16:14.000000000 +0300 +++ modules/comment/views_handler_field_comment_link.inc 2010-03-17 15:08:18.000000000 +0200 @@ -8,6 +8,7 @@ class views_handler_field_comment_link e parent::construct(); $this->additional_fields['cid'] = 'cid'; $this->additional_fields['nid'] = 'nid'; + $this->additional_fields['thread'] = 'thread'; } function option_definition() { @@ -32,7 +33,9 @@ class views_handler_field_comment_link e function render($values) { $text = !empty($this->options['text']) ? $this->options['text'] : t('view'); - return l($text, "node/" . $values->{$this->aliases['nid']}, array('html' => TRUE, 'fragment' => "comment-" . $values->{$this->aliases['cid']})); + $node = db_fetch_object(db_query('SELECT n.nid, n.type, s.comment_count FROM {node} n LEFT JOIN {node_comment_statistics} s ON s.nid = n.nid WHERE n.nid = %d', $values->{$this->aliases['nid']})); + $count=db_result(db_query("SELECT COUNT(*) FROM {comments} WHERE nid=%d AND thread >= '%s'", $node->nid, $values->{$this->aliases['thread']})); + return l($text, "node/" . $values->{$this->aliases['nid']}, array('html' => TRUE, 'query' => comment_new_page_count($node->comment_count, $count, $node), 'fragment' => "comment-" . $values->{$this->aliases['cid']})); } }