Definition

hook_comment($op, $comment)
contributions/docs/developer/hooks/core.php, line 96

Description

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

Namesort iconDescription
HooksAllow modules to interact with 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)));
}