function hook_delete
7.x node.api.php | hook_delete($node) |
6.x node.php | hook_delete(&$node) |
Respond to node deletion.
This is a hook used by node modules. It is called to allow the module to take action when a node is being deleted from the database by, for example, deleting information from related tables.
Parameters
&$node: The node being deleted.
Return value
None.
To take action when nodes of any type are deleted (not just nodes of the type defined by this module), use hook_nodeapi() instead.
For a detailed usage example, see node_example.module.
Related topics
21 functions implement hook_delete()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- actions_delete in drupal-6.x/
includes/ actions.inc - Delete a single action from the database.
- block_box_delete in drupal-6.x/
modules/ block/ block.admin.inc - Menu callback; confirm deletion of custom blocks.
- comment_confirm_delete in drupal-6.x/
modules/ comment/ comment.admin.inc - Form builder; Builds the confirmation form for deleting a single comment.
- comment_delete in drupal-6.x/
modules/ comment/ comment.admin.inc - Menu callback; delete a comment.
- contact_admin_delete in drupal-6.x/
modules/ contact/ contact.admin.inc - Category delete page.
5 invocations of hook_delete()
- node_delete in drupal-6.x/
modules/ node/ node.module - Delete a node.
- node_type_delete in drupal-6.x/
modules/ node/ node.module - Deletes a node type from the database.
- taxonomy_del_term in drupal-6.x/
modules/ taxonomy/ taxonomy.module - Delete a term.
- taxonomy_del_vocabulary in drupal-6.x/
modules/ taxonomy/ taxonomy.module - Delete a vocabulary.
- user_delete in drupal-6.x/
modules/ user/ user.module - Delete a user.
File
- documentation-6.x/
developer/ hooks/ node.php, line 189 - These hooks are defined by node modules, modules that define a new kind of node.
Code
function hook_delete(&$node) {
db_query('DELETE FROM {mytable} WHERE nid = %d', $node->nid);
}