I use the `printAllTagsAs()` function to display a tagcloud, with a counter on every tag. I noticed that even the unpublished objects are counted, so it cuold be possible that a unprivileged user click on the tag "photo(3)" but the search display no results.
I found that the problem is in the function `getAllTagsCount()`, in the sql request: I think the line
`$sql = "SELECT DISTINCT tags.name, tags.id, (SELECT COUNT(*) FROM ".prefix('obj_to_tag')." as object WHERE object.tagid = tags.id) AS count FROM ".prefix('tags')." as tags ORDER BY`name`";`
should be improved to count only the ids that matches "show=1" in the image table.
How can this be written?
Thanks
Comments
So you need to check the full tree first.
wow now it seems to be a very hard query to write, since it has to check dinamically every albumid and parentid for subalbums, stopping when parentid=NULL... have you got some ideas?
If you want to do this right now look at the functions getImageAlbumList(), getImageStatistics, getAlbumStatistics functions of the image_album_statistics plugin. Those actually do what this function would need.
You could open a ticket as I have to discuss that with sbillard. Of course this means overhead.