Posted by sinasquax on September 22, 2009 at 10:20am
Jump to:
| Project: | Tagadelic |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
Hello, there is a small bug with language and access because of not use of db_rewrite_sql in the module.
Also, i18n_taxonomy module checks if the sql has the {term_node} table and if yes, it doesn't alter the sql and the language check is not performed.
I have created a little patch to use db_rewrite_sql and a small trick to use term_node table without i18n_taxonomy find it, this patch handles correctly cache also.
Replace in tagadelic.module the tagadelic_get_weighted_tags function by :
<?php
function tagadelic_get_weighted_tags($vids, $steps = 6, $size = 60) {
global $language;
// build the options so we can cache multiple versions
$options = implode($vids) .'_'. $steps .'_'. $size .'_'. $language->language;
// Check if the cache exists
$cache_name = 'tagadelic_cache_'. $options;
$cache = cache_get($cache_name);
// make sure cache has data
if (isset($cache->data)) {
$tags = $cache->data;
}
else {
if (!is_array($vids) || count($vids) == 0) {
return array();
}
$result = db_query_range(db_rewrite_sql('SELECT COUNT(*) AS count, t.tid, t.name, t.vid FROM {term_data} t INNER JOIN ' . db_prefix_tables('{term_node}') . ' n ON t.tid = n.tid WHERE t.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') GROUP BY t.tid, t.name, t.vid ORDER BY count DESC', 't'), $vids, 0, $size);
$tags = tagadelic_build_weighted_tags($result, $steps);
cache_set($cache_name, $tags, 'cache', CACHE_TEMPORARY);
}
return $tags;
}
?>
Comments
#1
already patched and partly committed in another thread. Thanks for your time on this.
#2
Yes this is a duplicate of http://drupal.org/node/141682 but don't forget to use the db_prefix_tables('{term_node}') trick to force i18n_taxonomy to rewrite sql for languages.
Thank you
#3
Hi,
i tried to use your patch.
German ist the first language on my site.
English the second language.
Now in english cumulus disappeared.
How did you organize your translation of terms in Taxonomy?
Thanks markus
#4
will there be a new release soon for the 6.x branch? I really need this feature in order to be able to display language-dependant tagclouds :-(
#5
Thanks a lot for contribution!!!!
it's very helpful and simple to use!