terms AS t INNER JOIN $bbdb->term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN $bbdb->term_relationships AS tr ON tt.term_taxonomy_id = tr.term_taxonomy_id INNER JOIN $bbdb->topics as tp ON object_id=topic_id WHERE tt.taxonomy='bb_topic_tag' AND tt.count >= $min AND forum_id IN($hidden_forums_list)"; } else { // bbpress 0.9 $query="SELECT tag as name,t.tag_count as count FROM $bbdb->tags as t INNER JOIN $bbdb->tagged as tt ON t.tag_id=tt.tag_id INNER JOIN $bbdb->topics as tp ON tp.topic_id=tt.topic_id WHERE t.tag_count >= $min AND forum_id IN($hidden_forums_list)"; } $results=$bbdb->get_results($query); if (empty($results) || !is_array($results)) {return;} foreach ($results as $result) { if (isset($tags[$result->name])) { $tags[$result->name]-=$result->count; if ($tags[$result->name]<1) {unset($tags[$result->name]);} } } unset($results); // force cleanup for large array } ?>