--- D:\AppServ\www\d6\sites\all\modules\tagadelic\tagadelic.module.bak Wed Feb 27 22:32:06 2008 +++ D:\AppServ\www\d6\sites\all\modules\tagadelic\tagadelic.module Fri Aug 15 11:48:22 2008 @@ -208,8 +208,10 @@ * @return An unordered array with tags-objects, containing the attribute $tag->weight; */ function tagadelic_get_weighted_tags($vids, $steps = 6, $size = 60) { + global $user; + // build the options so we can cache multiple versions - $options = implode($vids) .'_'. $steps .'_'. $size; + $options = implode('_',$vids) .'_'. implode('_',$user->roles) .'_'. $steps .'_'. $size; // Check if the cache exists $cache_name = 'tagadelic_cache_'. $options; @@ -223,8 +225,9 @@ 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(db_rewrite_sql('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); $tags = tagadelic_build_weighted_tags($result, $steps);