If one uses Smartqueue taxonomy to create a new nodequeue and then a View to show only nodes per subqueue, the view will always show all nodes from the queue and cannot be filtered by subqueue. Views uses the following query to show the nodequeue for term 11:

SELECT node.nid AS nid, 
nodequeue_nodes_node.position AS nodequeue_nodes_node_position 
FROM node node 
INNER JOIN nodequeue_nodes nodequeue_nodes_node 
  ON node.nid = nodequeue_nodes_node.nid 
  AND nodequeue_nodes_node.qid = 2 
LEFT JOIN nodequeue_subqueue nodequeue_nodes_node__nodequeue_subqueue 
  ON nodequeue_nodes_node.qid = nodequeue_nodes_node__nodequeue_subqueue.qid 
WHERE (node.status <> 0 OR node.uid = ***CURRENT_USER*** or ***ADMINISTER_NODES*** = 1) 
  AND (nodequeue_nodes_node__nodequeue_subqueue.reference = '11') 
ORDER BY nodequeue_nodes_node_position ASC

The problem lies in this JOIN here:

LEFT JOIN nodequeue_subqueue nodequeue_nodes_node__nodequeue_subqueue 
  ON nodequeue_nodes_node.qid = nodequeue_nodes_node__nodequeue_subqueue.qid 

To make this work it should be:

LEFT JOIN nodequeue_subqueue nodequeue_nodes_node__nodequeue_subqueue 
  ON nodequeue_nodes_node.sqid = nodequeue_nodes_node__nodequeue_subqueue.sqid 

It needs to join on sqid instead of qid.

CommentFileSizeAuthor
#1 nodequeue_subqueue_view.diff450 bytesdalin

Comments

dalin’s picture

Status: Active » Needs review
StatusFileSize
new450 bytes

I believe simply altering the definition of $data['nodequeue_subqueue']['table']['join'] will do the trick.

ezra-g’s picture

Title: Cannot filter nodequeue views by subqueue » Cannot filter nodequeue views by subqueue reference
Status: Needs review » Fixed

In my testing filtering by subqueue reference (without using the argument, which seemed to work fine) was in fact behaving as you described and this patch resolved the issue without causing any other issues.

In other words, this is committed. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.