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.

CommentFileSizeAuthor
#1 nodecomment_comment_update.patch3.42 KBquicksketch

Comments

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new3.42 KB

Here's a patch that should correct the issue. I've committed to the 2.x branch.

quicksketch’s picture

It 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.

Status: Fixed » Closed (fixed)

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