1.20.x comment.api.php hook_comment_predelete($comment)

Act before comment deletion.

This hook is invoked from comment_delete_multiple() before field_attach_delete() is called and before the comment is actually removed from the database.

Parameters

$comment: The comment object for the comment that is about to be deleted.

See also

hook_comment_delete()

comment_delete_multiple()

entity_delete_multiple()

Related topics

File

modules/comment/comment.api.php, line 141
Hooks provided by the Comment module.

Code

function hook_comment_predelete($comment) {
  // Delete a record associated with the comment in a custom table.
  db_delete('example_comment_table')
    ->condition('cid', $comment->cid)
    ->execute();
}