function hook_comment
6.x core.php | hook_comment(&$a1, $op) |
Respond to comment actions.
This hook allows modules to extend the comments system by responding when certain actions take place.
Parameters
$a1: Argument; meaning is dependent on the action being performed.
- For "validate", "update", and "insert": an array of form values submitted by the user.
- For all other operations, the comment the action is being performed on.
$op: The action being performed. Possible values:
- "insert": The comment is being inserted.
- "update": The comment is being updated.
- "view": The comment is being viewed. This hook can be used to add additional data to the comment before theming.
- "validate": The user has just finished editing the comment and is trying to preview or submit it. This hook can be used to check the comment. Errors should be set with form_set_error().
- "publish": The comment is being published by the moderator.
- "unpublish": The comment is being unpublished by the moderator.
- "delete": The comment is being deleted by the moderator.
Related topics
7 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 drupal-6.x/
themes/ chameleon/ chameleon.theme - comment_invoke_comment in drupal-6.x/
modules/ comment/ comment.module - Invoke a hook_comment() operation in all modules.
- search_comment in drupal-6.x/
modules/ search/ search.module - Implementation of hook_comment().
- template_preprocess_comment in drupal-6.x/
modules/ comment/ comment.module - Process variables for comment.tpl.php.
- theme_comment in documentation-6.x/
developer/ theme.php - Implemented using the comment.tpl.php template.
5 invocations of hook_comment()
- comment_invoke_comment in drupal-6.x/
modules/ comment/ comment.module - Invoke a hook_comment() operation in all modules.
- comment_render in drupal-6.x/
modules/ comment/ comment.module - Renders comment(s).
- hook_search in documentation-6.x/
developer/ hooks/ core.php - Define a custom search routine.
- theme_comment_flat_expanded in drupal-6.x/
modules/ comment/ comment.module - Theme comment flat expanded view.
- theme_comment_thread_expanded in drupal-6.x/
modules/ comment/ comment.module - Theme comment thread expanded view.
File
- documentation-6.x/
developer/ hooks/ core.php, line 270 - These are the hooks that are invoked by the Drupal core.
Code
function hook_comment(&$a1, $op) {
if ($op == 'insert' || $op == 'update') {
$nid = $a1['nid'];
}
cache_clear_all_like(drupal_url(array('id' => $nid)));
}