I am trying to add that to mine and curious where can I find the code?
Thanks!
Also is there something I can find where you can list the topic other in the table list?
I am trying to add that to mine and curious where can I find the code?
Thanks!
Also is there something I can find where you can list the topic other in the table list?
I include that functionality in the My Views plugin but here is a newer version of the code that calculates it only once every 10 minutes and saves the result to reduce the load.
Once you install the plugin, you just add a column to the forum table like this:
<td class="num"><?php echo bb_number_format_i18n($GLOBALS['forum']->views); ?></td>
<?php
/*
Plugin Name: Forum Views
Author: _ck_
Author URI: http://bbShowcase.org
*/
add_filter('get_forums','forums_views_append');
function forums_views_append($forums) {
if (!is_front() && !is_forum()) {return $forums;}
global $bbdb, $forums_views;
if (empty($forums_views)) {$forums_views=bb_get_option('forums_views');}
if (empty($forums_views) || floor($forums_views[0]/600)!=floor(time()/600)) {
if (empty($forums_views)) {$old_sum=0;} else {$old_sum=array_sum($forums_views);}
if (defined('BACKPRESS_PATH')) {
$query="SELECT forum_id, SUM(meta_value) AS sum_meta_value
FROM $bbdb->meta LEFT JOIN $bbdb->topics ON $bbdb->meta.object_id = $bbdb->topics.topic_id
WHERE $bbdb->topics.topic_status=0 AND $bbdb->meta.meta_key='views' AND $bbdb->meta.object_type='bb_topic'
GROUP BY $bbdb->topics.forum_id";
} else {
$query="SELECT forum_id, SUM(meta_value) AS sum_meta_value
FROM $bbdb->topicmeta LEFT JOIN $bbdb->topics ON $bbdb->topicmeta.topic_id = $bbdb->topics.topic_id
WHERE $bbdb->topics.topic_status=0 AND $bbdb->topicmeta.meta_key='views'
GROUP BY $bbdb->topics.forum_id";
}
$results = $bbdb->get_results($query);
foreach ($results as $result) {$forums_views[$result->forum_id]=$result->sum_meta_value;}
$new_sum=array_sum($forums_views);
// if ($old_sum!=$new_sum) {
$forums_views[0]=time();
if ($old_sum==0) {bb_update_option('forums_views',$forums_views);}
else {
$value=addslashes(serialize($forums_views));
if (defined('BACKPRESS_PATH')) {
$query="UPDATE $bbdb->meta SET meta_value='$value' WHERE object_id='0' AND object_type='bb_option' AND meta_key='forums_views' LIMIT 1";
} else {
$query="UPDATE $bbdb->topicmeta SET meta_value='$value' WHERE topic_id=0 AND meta_key='forums_views' LIMIT 1";
}
@$bbdb->query($query);
}
// }
}
foreach ($forums as $id=>$forum) {if (!empty($forums_views[$id])) {$forums[$id]->views=$forums_views[$id];} else {$forums[$id]->views=0;}}
return $forums;
}
Thanks man! Do you have any plugin to see the forum posts author?
Yah, see this http://bbpress.org/plugins/topic/forum-last-poster/
Thanks so much for your help and I did discover that last night. I love BBpress so far but been running into a few glitches. Like for some reason I lost my stickies and the forum freshness displays times for the last post. I think I might be using the wrong function but I can figure it out.
If I need more of your help, I will be giving you a donation so I can get my system up and running
Oh some of my members are asking if do you have a version of Post Count Plus with more Custom Titles?
Here is what I got so far: http://www.mcserverreview.com/forum
(still building the CSS and PHP)
I would advise you asking the rest of your questions on bbpress.org as my time is extremely limited these days.
Donations aren't payments for services, they would be for all of my plugins you are already using
I'm not actually for hire.
OK. Thanks for the help then.
By the way, your query count for every page is entirely too high, almost twice what it should be, making things slow.
Because you are using 1.0 this is more difficult to fix.
But you can find some of my tips and tricks on bbpress.org
http://bbpress.org/forums/topic/heres-how-to-fix-some-of-the-10-query-performance-regression
RSS feed for this topic
You must log in to post.