If I have two taxonomies - lets say one has (red, blue, yellow) and the other one has (one, two, three) for an example, and set up a smartqueue using them both, and then go into a node with 'blue' and 'two' assigned to it, then I get three links when viewing the node - one allows the node to be added to the (blue-two) subqueue, one allows it to be added to the (blue-null) smartqueue, and one allows it to be added to the (null-two) smartqueue. As I understand it, this is wrong - there should only be a link to the (blue-two) smartqueue. (If I had created the node with blue but had not chosen a term from the second taxonomy, then it should show a link to (blue-null).)
The cause for this seems to be in the smartqueue_taxonomy_nodequeue_subqueues function. In it, while it's gathering the taxonomy terms for each vocabulary in the smartqueue, it adds a '0' tid to each vocabulary. Then, when it goes through all the combinations for a 2-vocabulary smartqueue, it ends up with a-b, a-0, and 0-b. (The 0-0 combination is automatically thrown out.) I can see the 0 is intended to represent the null taxonomy entry, but it seems like it should only be used if that vocabulary has no items in it - I wrapped the 'add a zero' line like so:
if (count($vids[$vid]) == 0) {
$vids[$vid][] = 0;
}
This seems to work, but you have to also remove the array_pop call intended to remove the 0-0 (or single 0 for the single vocabulary smartqueue) as it's no longer generated.
Thoughts? I can put together a patch, although currently that function has a lot of personal notes on the program flow - it wasn't obvious to me what it was doing at first.
Comments
Comment #1
merlinofchaos commentedI think you're right. This looks pretty reasonable to me. Care to turn this into a patch?
Comment #2
merlinofchaos commentedSeems like this is fixed on the 6.x version already.
Comment #3
ezra-g commentedDrupal 5 is no longer a supported core version.