You are here

function nodequeue_remove_action in Nodequeue 6.2

Same name and namespace in other branches
  1. 5.2 nodequeue.actions.inc \nodequeue_remove_action()
  2. 7.3 includes/nodequeue.actions.inc \nodequeue_remove_action()
  3. 7.2 includes/nodequeue.actions.inc \nodequeue_remove_action()

Action to remove a node from a queue.

1 call to nodequeue_remove_action()
nodequeue_add_action in ./nodequeue.module
Action to add a node to a queue.

File

./nodequeue.module, line 1984
Maintains queues of nodes in arbitrary order.

Code

function nodequeue_remove_action($node, $context) {
  $qids = $context['qids'];

  // If a node is being deleted, ensure it's also removed from any queues.
  $placeholders = implode(',', array_fill(0, count($qids), '%d'));
  $args = $qids;
  $args[] = $node->nid;
  $result = db_query("SELECT * FROM {nodequeue_nodes} WHERE qid IN ({$placeholders}) AND nid = %d", $args);
  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);
  }
}