1st, I'm sorry for the long post. All this is just a theory.

I had a discussion with grohk on IRC.
It seems that the module doesn't update the number of comments assosiated with a node after unpublishing.
Here's an example:
http://www.foolab.org/node/505
it shows 1 comment on the main page, but there is nothing.
mysql> select * from node_comment_statistics where nid=505;
+-----+-----+------------------------+-------------------+------------------+---------------+
| nid | cid | last_comment_timestamp | last_comment_name | last_comment_uid | comment_count |
+-----+-----+------------------------+-------------------+------------------+---------------+
| 505 | 0 | 1102857148 | texas holdem | 0 | 1 |
+-----+-----+------------------------+-------------------+------------------+---------------+
1 row in set (0.01 sec)

seems that node_comment_statistics isn't updated.
I didn't find a standard way to unpublish a comment, I didn't even know how it's done. I'm lost in the code!
but I found a function in comments.module
_comment_update_node_statistics()
/**
* Updates the comment statistics for a given node. This should be called any * time a comment is added, deleted, or updated. *
I think that this is the function missing from spam module.

grep node_comment_statistics spam.module
returns no results

function spam_admin_unpublish_node($nid) {
db_query('UPDATE {node} SET status = 0 WHERE nid = %d', $nid);
}
I think that this function should call _comment_update_node_statistics()

CommentFileSizeAuthor
#2 spam.module_2.patch694 bytesjeremy

Comments

grohk’s picture

jeremy’s picture

Assigned: Unassigned » jeremy
StatusFileSize
new694 bytes

You are correct. The attached patch has been applied to CVS and the 4.5 version of the module.

Anonymous’s picture