hook_comment

Versions
4.6
hook_comment($op, $comment)
4.7
hook_comment($a1, $op)
5 – 6
hook_comment(&$a1, $op)

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

Code

developer/hooks/core.php, line 96

<?php
function hook_comment($op, $comment) {
  if ($op == 'insert' || $op == 'update') {
    $nid = $comment['nid'];
  }

  cache_clear_all_like(drupal_url(array('id' => $nid)));
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.