It might be by design but unpublished nodes affect the size of the categories. I have changed the code as follows feel free to make the change if you believe it should only count published nodes.

Index: tagadelic.module
===================================================================
--- tagadelic.module    (revision 1216)
+++ tagadelic.module    (revision 1217)
@@ -183,7 +183,7 @@
   }

   // Fetch tags
-  $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') GROUP BY d.tid, d.name ORDER BY count DESC', $vids, 0, $size);
+  $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid INNER JOIN node nd USING (nid) WHERE nd.status = 1 AND d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') GROUP BY d.tid, d.name ORDER BY count DESC', $vids, 0, $size);

   // Find minimum and maximum log-count.
   $tags = array();

Comments

Bèr Kessels’s picture

Status: Reviewed & tested by the community » Active

Could you try to make a real path? http://drupal.org/diffandpatch explains how to do this.

ericwagner’s picture

StatusFileSize
new958 bytes

I think this is the right way:

--- modules/tagadelic/tagadelic.module.orig	2006-11-10 14:38:34.000000000 -0800
+++ modules/tagadelic/tagadelic.module	2006-11-10 14:58:42.000000000 -0800
@@ -207,7 +207,7 @@ function tagadelic_get_weighted_tags($vi
   if (!is_array($vids) || count($vids) == 0) {
     return array();
   }
-  $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', $vids, 0, $size);
+  $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid INNER JOIN {node} nd USING (nid) WHERE nd.status = 1 AND d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', $vids, 0, $size);
 
   return tagadelic_build_weighted_tags($result, $steps);
 }
ericwagner’s picture

StatusFileSize
new922 bytes

Here is the same patch without a path (not sure what you wanted.)

Bèr Kessels’s picture

Status: Active » Postponed (maintainer needs more info)

I meant patch, path was a typo. Sorry.

I'd like some enlightenment on the choice for USING(nid). I cannot see why that is needed if all you want is some filtering on status. But then again: am not a SQL guru. Please explain.

Bèr Kessels’s picture

Status: Postponed (maintainer needs more info) » Needs work

Merging issue at http://drupal.org/node/62840 with this one.

meatbites’s picture

Bèr, I don't know whether you discovered this, but we need the nid in order to link to the {node} table. From there we can check the published status of a node, as that's where it's stored.

By the looks of things, you may need to look into caching. I realise this will negate your "small module, without any databases, or configuration" spiel, but it is kinda necessary.

Without caching, the module would create significant overhead every time a sizeable tag list is generated, because for each tag, it not only needs to find the publication status of each node but also only seek out those for which the user has permission.

And I'm pretty sure filtering on both node status and permissions are needed.

Edit: I may have spoken too soon, as apparently Tagadelic already uses caching. Perhaps adding node status and permissions to that won't be such a large job, after all.

scottrigby’s picture

re: #5

is this patch supposed to solve this merged issue? (http://drupal.org/node/62840)

For me, it does not. Tags from unpublished nodes still show :(

geodaniel’s picture

subscribing

wuf31’s picture

StatusFileSize
new824 bytes

Try this patch.. It works for me.
I patched the drupal 6 version. But I think it should work for v5 as well.

EDIT: Sorry, it only fix the access issues, not the published status. The sql at the issue starter may fix it though.

Bèr Kessels’s picture

I just applied a patch that implodes the cache with a _, can you reroll this patch wihtou your implode with a dot (.)

Also please use unified patches, they are a lot easier to read.

Then, please find/poke people to test a patch. I need testers with real data to confirm it a) works, b) does not break their site.

Bèr Kessels’s picture

Status: Needs work » Closed (duplicate)
wuf31’s picture

Status: Closed (duplicate) » Needs work

Ok, the access patch is a duplicate, though i think we still need to work on the published status.
I'll post the access patch at #141682: access control aware tag clouds

Bèr Kessels’s picture

Status: Needs work » Closed (duplicate)