Same name and namespace in other branches
- 4.7.x developer/hooks/core.php \hook_comment()
- 5.x developer/hooks/core.php \hook_comment()
- 6.x developer/hooks/core.php \hook_comment()
Act on comment modification.
This hook allows modules to take action whenever changes are made to comments.
Parameters
$op: What type of action is being performed. Possible values:
- "insert"
- "moderate"
- "update"
comment: The comment on which the action is being performed.
Return value
None.
Related topics
3 functions implement hook_comment()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- chameleon_comment in themes/
chameleon/ chameleon.theme - theme_comment in modules/
comment.module - xtemplate_comment in themes/
engines/ xtemplate/ xtemplate.engine
5 invocations of hook_comment()
- comment_moderate in modules/
comment.module - comment_post in modules/
comment.module - comment_save in modules/
comment.module - queue_view in modules/
queue.module - Display a queued node along with voting options for it.
- _comment_delete_thread in modules/
comment.module
File
- developer/
hooks/ core.php, line 96 - These are the hooks that are invoked by the Drupal core.
Code
function hook_comment($op, $comment) {
if ($op == 'insert' || $op == 'update') {
$nid = $comment['nid'];
}
cache_clear_all_like(drupal_url(array(
'id' => $nid,
)));
}