You are here

function nodequeue_nodeapi in Nodequeue 5.2

Same name and namespace in other branches
  1. 5 nodequeue.module \nodequeue_nodeapi()
  2. 6.2 nodequeue.module \nodequeue_nodeapi()

Implementation of hook_nodeapi

File

./nodequeue.module, line 243

Code

function nodequeue_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  switch ($op) {
    case 'delete':

      // If a node is being deleted, ensure it's also removed from any queues.
      $result = db_query("SELECT * FROM {nodequeue_nodes} WHERE nid = %d", $node->nid);
      while ($obj = db_fetch_object($result)) {

        // This removes by nid, not position, because if we happen to have a
        // node in a queue twice, the 2nd position would be wrong.
        nodequeue_subqueue_remove_node($obj->sqid, $node->nid);
      }
      break;
  }
}