function nodeapi_example_node_delete in Examples for Developers 7
Implements hook_node_delete().
When a node is deleted, we need to remove all related records from our table, including all revisions. For the delete operations we use node->nid.
Related topics
File
- nodeapi_example/
nodeapi_example.module, line 173 - Module implementation for nodeapi_example module.
Code
function nodeapi_example_node_delete($node) {
// Notice that we're deleting even if the content type has no rating enabled.
db_delete('nodeapi_example')
->condition('nid', $node->nid)
->execute();
}