Commit f2e3917a authored by Dries's avatar Dries
Browse files

- Patch #762234 by catch: give modules access to updated comment statistics in...

- Patch #762234 by catch: give modules access to updated comment statistics in hook_comment_insert() and hook_comment_update().
parent 1bb6e13d
...@@ -1410,6 +1410,10 @@ function comment_save($comment) { ...@@ -1410,6 +1410,10 @@ function comment_save($comment) {
)) ))
->condition('cid', $comment->cid) ->condition('cid', $comment->cid)
->execute(); ->execute();
// Update the {node_comment_statistics} table prior to executing hooks.
_comment_update_node_statistics($comment->nid);
field_attach_update('comment', $comment); field_attach_update('comment', $comment);
// Allow modules to respond to the updating of a comment. // Allow modules to respond to the updating of a comment.
module_invoke_all('comment_update', $comment); module_invoke_all('comment_update', $comment);
...@@ -1495,14 +1499,15 @@ function comment_save($comment) { ...@@ -1495,14 +1499,15 @@ function comment_save($comment) {
// saved node to be propagated to the slave. // saved node to be propagated to the slave.
db_ignore_slave(); db_ignore_slave();
// Update the {node_comment_statistics} table prior to executing hooks.
_comment_update_node_statistics($comment->nid);
field_attach_insert('comment', $comment); field_attach_insert('comment', $comment);
// Tell the other modules a new comment has been submitted. // Tell the other modules a new comment has been submitted.
module_invoke_all('comment_insert', $comment); module_invoke_all('comment_insert', $comment);
entity_invoke('insert', 'comment', $comment); entity_invoke('insert', 'comment', $comment);
} }
_comment_update_node_statistics($comment->nid);
if ($comment->status == COMMENT_PUBLISHED) { if ($comment->status == COMMENT_PUBLISHED) {
module_invoke_all('comment_publish', $comment); module_invoke_all('comment_publish', $comment);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment