You are here

function nodequeue_remove_action in Nodequeue 5.2

Same name and namespace in other branches
  1. 6.2 nodequeue.module \nodequeue_remove_action()
  2. 7.3 includes/nodequeue.actions.inc \nodequeue_remove_action()
  3. 7.2 includes/nodequeue.actions.inc \nodequeue_remove_action()
1 call to nodequeue_remove_action()
nodequeue_add_action in ./nodequeue.actions.inc
Action to add a node to a queue.

File

./nodequeue.actions.inc, line 212
nodequeue.actions.inc Provides actions integration for node queues.

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);
  }
}