Same name and namespace in other branches
- 4.7.x modules/node.module \node_delete()
- 5.x modules/node/node.module \node_delete()
- 6.x modules/node/node.module \node_delete()
- 7.x modules/node/node.module \node_delete()
Ask for confirmation, and delete the node.
2 calls to node_delete()
- blogapi_blogger_delete_post in modules/
blogapi.module - Blogging API callback. Removes the specified blog node.
- forum_taxonomy in modules/
forum.module - Implementation of hook_taxonomy().
File
- modules/
node.module, line 1606 - The core that allows content to be submitted to the site.
Code
function node_delete($edit) {
$node = node_load(array(
'nid' => $edit['nid'],
));
if (node_access('delete', $node)) {
if ($edit['confirm']) {
// Delete the specified node:
db_query('DELETE FROM {node} 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');
}
watchdog('content', t('%type: deleted %title.', array(
'%type' => theme('placeholder', t($node->type)),
'%title' => theme('placeholder', $node->title),
)));
}
else {
$extra = form_hidden('nid', $node->nid);
$output = theme('confirm', t('Are you sure you want to delete %title?', array(
'%title' => theme('placeholder', $node->title),
)), $_GET['destination'] ? $_GET['destination'] : 'node/' . $node->nid, t('This action cannot be undone.'), t('Delete'), t('Cancel'), $extra);
}
}
return $output;
}