When the abuse module unpublishes a comment via the _abuse_disable function, it does not update the comment statistics for the associated node. This causes comment counts to be inaccurate in the node_comment_statistics DB table. I think this issue could be resolved by calling _comment_update_node_statistics in the _abuse_disable function after changing the status of a comment.

According to the code comments in in comments.module, the _comment_update_node_statistics function "should be called any time a comment is added, deleted, or updated."

Please let me know if I should submit a patch for this.

Comments

buzzman’s picture

patch would be gr8, but if u r pressed for time, then just post the code snip - thanks

buzzman’s picture

Status: Active » Needs review

nevermind, this code should do the trick:

EDITED:


    if ('comment' == $type) {
      $nid = db_result(db_query("SELECT nid FROM {comments} where cid=%d", $oid));
    }
    if ($nid) {
      _comment_update_node_statistics($nid);
    }

place the above code block in abuse.module in-between these 2 lines:

    _abuse_set_status($type, $oid, ABUSE_HIDDEN);

    < above_code_block_goes_here >

    _abuse_clear_oid_cache($oid);

do test and feedback - thanx