function nodequeue_subqueue_remove in Nodequeue 5.2
Same name and namespace in other branches
- 6.2 nodequeue.module \nodequeue_subqueue_remove()
- 7.3 nodequeue.module \nodequeue_subqueue_remove()
- 7.2 nodequeue.module \nodequeue_subqueue_remove()
Remove a node or node(s) from a nodequeue by position.
If you know the nid but but not the position, use
Parameters
$sqid: The subqueue to remove nodes from.
$start: The first position (starting from 1) to remove.
$end: The last position to remove. If NULL or equal to $start, only one node will be removed. Thus if $start is 1 and $end is 2, the first and second items will be removed from the queue.
See also
nodequeue_subqueue_remove_node() instead.
3 calls to nodequeue_subqueue_remove()
- nodequeue_admin_remove in ./
nodequeue.module - Page callback to remove an item from a queue. This will be used only if javascript is disabled in the client, and is a fallback technique. This differs from nodequeue_admin_remove_node in that it removes a specific position, which is necessary in case…
- nodequeue_check_subqueue_size in ./
nodequeue.module - Guarantee that a subqueue has not gotten too big. It's important to call this after an operation that might have reduced a queue's maximum size. It stores the count to save a query if this is to be followed by an add operation.
- 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 1934
Code
function nodequeue_subqueue_remove($sqid, $start, $end = NULL) {
if (!isset($end)) {
$end = $start;
}
$diff = $end - $start + 1;
db_query("DELETE FROM {nodequeue_nodes} WHERE sqid = %d AND position >= %d AND position <= %d", $sqid, $start, $end);
db_query("UPDATE {nodequeue_nodes} SET position = position - %d WHERE sqid = %d AND position > %d", $diff, $sqid, $end);
}