Steps to reproduce:
- call taxonomy_select_nodes() with pager = FALSE
Expected behaviour:
- receive a database result with all nodes matching tids.
Observed behaviour:
- only 10 results returned.
Upon checking the code for taxonomy_select_nodes I noticed that if you pass FALSE for the $pager argument, it uses the system variable 'feed_default_items' (or 10 if it isn't set). If you want to return more than 10 items using this function you need to set this variable in admin/content/rss-publishing. And if you want to return more than 30 you are out of luck, unless you go ahead and edit the variable by hand.
I don't think feed_default_items is the right variable to be using here. How many nodes you want returned from this function and how many items you want displayed in your RSS feed are two very different things.
While not technically a bug, I had to look at the source for the function (and then grep for feed_default_items to see where to set it) to get it to return more than 10 nodes. Perhaps the documentation needs to be changed.
Or, even better- something like this instead:
Have another argument, $items, which defaults to NULL. If $pager is FALSE, and $items != NULL, use $items as the number of nodes you want returned. If $pager is FALSE and $items is NULL, by all means use feed_default_items.
I realise this breaks the API, so won't be included in 5.x Perhaps something for HEAD.
I will write a patch for HEAD if people agree with my proposed change.
Comments
Comment #1
carlitus commented+1
Comment #2
asimmonds commentedA third use-case (not paged or feed) for taxonomy_select_nodes() is a feature request.
Moving to 7.x.
If you have a special case, Views may be able to do what you want.
Comment #3
david.r.benham commentedRan across a need for this 'feature' today and a justification for a third use-case. I have a page doing image rotation, images for use in the rotation are image nodes in the system categorized by taxonomy. I'd like to grab one of the candidate images randomly, and I use the taxonomy_select_nodes() function, but I cannot get a complete listing unless I alter feed_default_items, which I have done as a work around in the meantime.
Comment #4
nrackleff commentedI had the same problem. I made a nav menu using taxonomy_select_nodes and when I had more than 10 items, only the first 10 showed up. When I looked at the code for taxonomy_select_nodes I was surprised to see that it used the feed variable. In my case, setting the feed variable to 30 was enough to solve the immediate problem, but I would like to follow this issue for future reference.
Comment #5
catchDuplicate of #389598: taxonomy_select_nodes() limits results based on "Number of posts on main page" variable.
Comment #6
catch