Hello, I came here from http://bbpress.org/plugins/topic/bb-topic-views/ because you suggest there a new way to show view count. But I can't get it to work.
First you have this code:
function forums_views_append($forums) {
global $bbdb; $sum_meta_value="SUM(meta_value)";
$forums_views = $bbdb->get_results(" SELECT $sum_meta_value,forum_id FROM $bbdb->topicmeta LEFT JOIN $bbdb->topics ON $bbdb->topicmeta.topic_id = $bbdb->topics.topic_id WHERE $bbdb->topicmeta.meta_key='views' GROUP BY $bbdb->topics.forum_id");
foreach ($forums_views as $forum_views) {$forums[$forum_views->forum_id]->views=$forum_views->$sum_meta_value; }
return $forums;
}
add_filter('get_forums','forums_views_append');
Where do I add that? To bb-topic-views.php?
And then I have to add to front-page.php template this: <?php echo $forum->views; ?>
I suppose that should replace <?php show_view_count(); ?> from the original plugin?
I'd like to figure this out since I do need and want to display views for topics but on my forums front page alone it generates 30 queries and I'd like to lower that number. Any help is appreciated, thanks!
![US [5] US](/images/flags/us.png)
![DE [1] DE](/images/flags/de.png)
in the past 30 minutes.