You are here

function nodequeue_get_subqueue_position in Nodequeue 7.3

Same name and namespace in other branches
  1. 5.2 nodequeue.module \nodequeue_get_subqueue_position()
  2. 6.2 nodequeue.module \nodequeue_get_subqueue_position()
  3. 7.2 nodequeue.module \nodequeue_get_subqueue_position()

Get the position of a node in a subqueue, or 0 if not found.

1 call to nodequeue_get_subqueue_position()
nodequeue_subqueue_remove_node in ./nodequeue.module
Remove a node from the queue. If a node is in the queue more than once, only the first (closest to 0 position, or the front of the queue) will be removed.

File

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

Code

function nodequeue_get_subqueue_position($sqid, $nid) {

  // We use MIN to make sure we always get the closes to the front of the
  // queue in case the queue has nodes in it multiple times.
  $pos = db_query("SELECT MIN(position) FROM {nodequeue_nodes} WHERE sqid = :sqid AND nid = :nid", array(
    ':sqid' => $sqid,
    ':nid' => $nid,
  ))
    ->fetchField();
  return $pos;
}