You are here

function _module_grants_node_delete in Module Grants 6.4

Same name and namespace in other branches
  1. 6.3 module_grants.module \_module_grants_node_delete()

Delete a node and all its revisions. Required because node.module's node_delete() has a hard-wired call to node_access() when we should be using module_grants_node_access().

1 call to _module_grants_node_delete()
module_grants_node_delete_confirm_submit in ./module_grants.pages.inc
Initiate node deletion and set the redirection page.

File

./module_grants.module, line 392
Module to apply access grants to pre-published content just as they are to published content and to make multiple content access modules work together in the expected way.

Code

function _module_grants_node_delete($nid) {
  $node = node_load($nid);
  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 page and block caches.
  cache_clear_all();

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