You are here

function nodehierarchy_delete_node in Node Hierarchy 5

Same name and namespace in other branches
  1. 6.3 nodehierarchy.module \nodehierarchy_delete_node()
  2. 6 nodehierarchy.module \nodehierarchy_delete_node()
  3. 6.2 nodehierarchy.module \nodehierarchy_delete_node()
  4. 7.4 nodehierarchy.admin.inc \nodehierarchy_delete_node()
  5. 7.2 nodehierarchy.module \nodehierarchy_delete_node()

Delete the nodehierarchy information when a node is deleted.

1 call to nodehierarchy_delete_node()
nodehierarchy_nodeapi in ./nodehierarchy.module
Implementation of hook_nodeapi().

File

./nodehierarchy.module, line 420
A module to make nodes hierarchical.

Code

function nodehierarchy_delete_node($node) {

  // Also delete corresponding menu item if nodehierarchy_menu_noadmin is true
  // Do this before actually removing the node from the hierarchy, else
  // we can't get it's descendants anymore
  if (function_exists('menu_node_form_delete') && variable_get('nodehierarchy_menus', TRUE) && variable_get('nodehierarchy_menu_noadmin', FALSE)) {
    menu_node_form_delete($node);
    menu_rebuild();
  }
  db_query('DELETE FROM {nodehierarchy} WHERE nid = %d OR parent = %d', $node->nid, $node->nid);
}