When a nodecomment gets updated, there is no call to nodecomment_save().
- nodecomment_save() is only called on node insert.
- nodecomment_save() only cares about INSERTing, not UPDATEing the comment
I ran into this problem when using nodecomment with workflow.module. When an unpublished nodecomment gets published by the editor, nodecomment_statistics does not get updated.
I fixed this by calling update in hook_nodeapi:
case 'update':
// if this is a comment, update it's parent's comment statistics.
if (isset($node->comment_target_nid)) {
_nodecomment_update_node_statistics($node->comment_target_nid);
}
break;
comments.module, on the other hand, is handling updates in comment_save(), which is called by comment_form_submit().
This was not the way to go for my quickfix, as nodecomment calls nodecomment_save() only in hook_nodeapi: insert.
Comments
Comment #1
quicksketchHere's a patch that should correct the issue. I've committed to the 2.x branch.
Comment #2
quicksketchIt applied fine to the 1.x branch so I've applied it there also. Though I'm not sure if the 1.2 final version will ever make it out.