Node Comment does not set a node's comment statistics to the correct value. The current behavior is that the node comment statistics (number of comments for a node) is set to the total number of comments for a node, both published and unpublished.

The query which currently determines the number of comments is:

SELECT COUNT(*) FROM {node_comments} nc INNER JOIN {node} n ON n.nid = nc.nid WHERE nc.nid = %d AND n.status = 1

This result of this query is the number of comments for a published node.

The query should instead count the number of published comments for a node:

SELECT COUNT(*) FROM {node_comments} nc INNER JOIN {node} n ON n.nid = nc.cid WHERE nc.nid = %d AND n.status = 1

CommentFileSizeAuthor
#2 nodecomment.issue701970-20100307.patch688 bytesiva2k

Comments

prabhakarsun’s picture

In which file I need to change it?

iva2k’s picture

StatusFileSize
new688 bytes

Here's a patch based on #1. Please review and report here.

prabhakarsun’s picture

It Works.

crea’s picture

Status: Needs review » Fixed

Thanks, commited.

Status: Fixed » Closed (fixed)
Issue tags: -statistics, -published

Automatically closed -- issue fixed for 2 weeks with no activity.