You are here

function node_delete in Drupal 5

Same name and namespace in other branches
  1. 4 modules/node.module \node_delete()
  2. 6 modules/node/node.module \node_delete()
  3. 7 modules/node/node.module \node_delete()

Delete a node.

4 calls to node_delete()
blogapi_blogger_delete_post in modules/blogapi/blogapi.module
Blogging API callback. Removes the specified blog node.
forum_taxonomy in modules/forum/forum.module
Implementation of hook_taxonomy().
node_delete_confirm_submit in modules/node/node.module
Execute node deletion
node_multiple_delete_confirm_submit in modules/node/node.module

File

modules/node/node.module, line 2415
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

function node_delete($nid) {
  $node = node_load($nid);
  if (node_access('delete', $node)) {
    db_query('DELETE FROM {node} WHERE nid = %d', $node->nid);
    db_query('DELETE FROM {node_revisions} WHERE nid = %d', $node->nid);

    // Call the node-specific callback (if any):
    node_invoke($node, 'delete');
    node_invoke_nodeapi($node, 'delete');

    // Clear the cache so an anonymous poster can see the node being deleted.
    cache_clear_all();

    // Remove this node from the search index if needed.
    if (function_exists('search_wipe')) {
      search_wipe($node->nid, 'node');
    }
    drupal_set_message(t('%title has been deleted.', array(
      '%title' => $node->title,
    )));
    watchdog('content', t('@type: deleted %title.', array(
      '@type' => t($node->type),
      '%title' => $node->title,
    )));
  }
}