<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>bbPress Support Forums Tag: count</title>
<link>http://bbpress.org/forums/</link>
<description>bbPress Support Forums Tag: count</description>
<language>en</language>
<pubDate>Fri, 09 Jan 2009 03:26:40 +0000</pubDate>

<item>
<title>_ck_ on "counting forums"</title>
<link>http://bbpress.org/forums/topic/counting-forums#post-21338</link>
<pubDate>Mon, 08 Dec 2008 13:13:36 +0000</pubDate>
<dc:creator>_ck_</dc:creator>
<guid isPermaLink="false">21338@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Okay if you want something simple you can make this into a mini-plugin:&#60;/p&#62;
&#60;p&#62;(call it &#60;code&#62;forum-totals.php&#60;/code&#62;)&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
/*
Plugin Name: Forum Totals
*/

function forum_totals() {
	global $forum_id;
	$forum = get_forum( $forum_id ); 	$topics=$forum-&#38;gt;topics; $posts=$forum-&#38;gt;posts;
	$forums=get_forums(array(&#38;#39;child_of&#38;#39; =&#38;gt; $forum_id));   $count=0;
	if ($forums) {foreach ($forums as $forum) {$count++; $topics+=$forum-&#38;gt;topics; $posts+=$forum-&#38;gt;posts;}}
	echo &#38;quot;&#38;lt;tr style=&#38;#39;background:#ccc;&#38;#39;&#38;gt;&#38;lt;td align=&#38;#39;right&#38;#39;&#38;gt;$count total forums:&#38;lt;/td&#38;gt;&#38;lt;td class=&#38;#39;num&#38;#39;&#38;gt;$topics&#38;lt;/td&#38;gt;&#38;lt;td class=&#38;#39;num&#38;#39;&#38;gt;$posts&#38;lt;/td&#38;gt;&#38;lt;/tr&#38;gt;&#38;quot;;
}

function forum_topics_including_subforums( $forum_id = 0 ) {
	echo apply_filters( &#38;#39;forum_topics&#38;#39;, get_forum_topics_including_subforums( $forum_id ), $forum_id );
}

function forum_posts_including_subforums( $forum_id = 0 ) {
	echo apply_filters( &#38;#39;forum_posts&#38;#39;, get_forum_posts_including_subforums( $forum_id ), $forum_id );
}

function get_forum_topics_including_subforums( $forum_id = 0 ) {
	$forum_id=get_forum_id( $forum_id );
	$forum = get_forum( $forum_id ); $topics=$forum-&#38;gt;topics;
	$forums=get_forums(array(&#38;#39;child_of&#38;#39; =&#38;gt; $forum_id));
	if ($forums) {foreach ($forums as $forum) {$topics+=$forum-&#38;gt;topics;}}
	return apply_filters( &#38;#39;get_forum_topics&#38;#39;, $topics, $forum_id );
}

function get_forum_posts_including_subforums( $forum_id = 0 ) {
	$forum_id=get_forum_id( $forum_id );
	$forum = get_forum( $forum_id ); $posts=$forum-&#38;gt;posts;
	$forums=get_forums(array(&#38;#39;child_of&#38;#39; =&#38;gt; $forum_id));
	if ($forums) {foreach ($forums as $forum) {$posts+=$forum-&#38;gt;posts;}}
	return apply_filters( &#38;#39;get_forum_posts&#38;#39;, $posts, $forum_id );
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;em&#62; &#60;/em&#62;&#60;br /&#62;
Install and activate it and then you need to put&#60;br /&#62;
&#60;code&#62;&#38;lt;?php forum_totals(); ?&#38;gt;&#60;/code&#62;&#60;br /&#62;
anywhere you want to see it, on &#60;code&#62;front-page.php&#60;/code&#62; or &#60;code&#62;forum.php&#60;/code&#62; templates.&#60;/p&#62;
&#60;p&#62;It should go between the &#60;code&#62;endwhile&#60;/code&#62; and the &#60;code&#62;&#38;lt;/table&#38;gt;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Like this:&#60;br /&#62;
&#60;em&#62; &#60;/em&#62;&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php  endwhile; ?&#38;gt;
&#38;lt;?php forum_totals(); ?&#38;gt;
&#38;lt;/table&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;em&#62; &#60;/em&#62;&#60;br /&#62;
To use the replacement functions for &#60;code&#62;forum_topics()&#60;/code&#62; and &#60;code&#62;forum_posts()&#60;/code&#62; which include the totals for a forum including it's subforums, simply replace them in your templates with &#60;code&#62;forum_topics_including_subforums();&#60;/code&#62; and &#60;code&#62;forum_posts_including_subforums();&#60;/code&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>clockworker on "counting forums"</title>
<link>http://bbpress.org/forums/topic/counting-forums#post-21337</link>
<pubDate>Mon, 08 Dec 2008 12:39:47 +0000</pubDate>
<dc:creator>clockworker</dc:creator>
<guid isPermaLink="false">21337@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;my front-page.php &#60;a href=&#34;http://pastebin.com/d117f4c3a&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/d117f4c3a&#60;/a&#62;&#60;br /&#62;
i want to countig all topics &#38;#38; posts
&#60;/p&#62;</description>
</item>
<item>
<title>_ck_ on "counting forums"</title>
<link>http://bbpress.org/forums/topic/counting-forums#post-21247</link>
<pubDate>Wed, 03 Dec 2008 18:07:51 +0000</pubDate>
<dc:creator>_ck_</dc:creator>
<guid isPermaLink="false">21247@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;&#60;strong&#62;update: there is a better version a few posts down&#60;/strong&#62;&#60;/p&#62;
&#60;p&#62;I had worked this out this quick and dirty routine but then I realized you might mean not to show it within the forum list. If you mean something different let me know.&#60;/p&#62;
&#60;p&#62;In front-page.php &#60;/p&#62;
&#60;p&#62;Change&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php  while ( bb_forum() ) :  ?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;em&#62; &#60;/em&#62;&#60;br /&#62;
to&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
forum_totals(&#38;quot;init&#38;quot;);
while ( bb_forum() ) :
forum_totals();
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;em&#62; &#60;/em&#62;&#60;/p&#62;
&#60;p&#62;and then this after the end of the forum list routine&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php  endwhile;  ?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;to this&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
endwhile;
forum_totals(&#38;quot;finish&#38;quot;);
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;em&#62; &#60;/em&#62;&#60;br /&#62;
This is the main function you can just drop at the bottom of front-page.php&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
function forum_totals($x=&#38;quot;&#38;quot;) {
static $last_parent,$total_posts,$total_topics,$all_topics,$all_posts,$total_counter,$all_counter;
if (function_exists(&#38;#39;bb_get_forum_is_category&#38;#39;)) {$category=bb_get_forum_is_category();} else {$category=false;}
if ($x==&#38;quot;init&#38;quot;) {$last_parent=false;  $total_topics=0; $total_posts=0; $all_topics=0; $all_posts=0; $total_counter=0; $all_counter=0; return;}
if ($x==&#38;quot;finish&#38;quot; &#124;&#124; $last_parent!==$GLOBALS[&#38;#39;forum&#38;#39;]-&#38;gt;forum_parent &#124;&#124; $category) {
	if ($last_parent!==false &#38;#38;&#38;#38; $total_counter&#38;gt;1) {echo &#38;quot;&#38;lt;tr&#38;gt;&#38;lt;td align=&#38;#39;right&#38;#39;&#38;gt;$total_counter subforums:&#38;lt;/td&#38;gt;&#38;lt;td class=&#38;#39;num&#38;#39;&#38;gt;$total_topics&#38;lt;/td&#38;gt;&#38;lt;td class=&#38;#39;num&#38;#39;&#38;gt;$total_posts&#38;lt;/td&#38;gt;&#38;lt;/tr&#38;gt;&#38;quot;;}
	$last_parent=$GLOBALS[&#38;#39;forum&#38;#39;]-&#38;gt;forum_parent; $total_topics=$GLOBALS[&#38;#39;forum&#38;#39;]-&#38;gt;topics; $total_posts=$GLOBALS[&#38;#39;forum&#38;#39;]-&#38;gt;posts;
	$total_counter=0;
} else {$total_topics+= (int) $GLOBALS[&#38;#39;forum&#38;#39;]-&#38;gt;topics; $total_posts+=(int) $GLOBALS[&#38;#39;forum&#38;#39;]-&#38;gt;posts;}
$all_topics+= (int) $GLOBALS[&#38;#39;forum&#38;#39;]-&#38;gt;topics; $all_posts+=(int) $GLOBALS[&#38;#39;forum&#38;#39;]-&#38;gt;posts;
if ($x==&#38;quot;finish&#38;quot;) {echo &#38;quot;&#38;lt;tr&#38;gt;&#38;lt;td align=&#38;#39;right&#38;#39;&#38;gt;$all_counter total forums:&#38;lt;/td&#38;gt;&#38;lt;td class=&#38;#39;num&#38;#39;&#38;gt;$all_topics&#38;lt;/td&#38;gt;&#38;lt;td class=&#38;#39;num&#38;#39;&#38;gt;$all_posts&#38;lt;/td&#38;gt;&#38;lt;/tr&#38;gt;&#38;quot;;}
elseif ($category) {$last_parent=false;} else {$all_counter++; $total_counter++; }
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>clockworker on "counting forums"</title>
<link>http://bbpress.org/forums/topic/counting-forums#post-21239</link>
<pubDate>Wed, 03 Dec 2008 12:05:27 +0000</pubDate>
<dc:creator>clockworker</dc:creator>
<guid isPermaLink="false">21239@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;can anybody a solution to count the subforums and give this counting to the forum.&#60;/p&#62;
&#60;p&#62;- Forum ( Subforum+Subforum2 = 3 topics &#124; 25 posts )&#60;br /&#62;
- Subforum ( 1 topic &#124; 5 posts ) &#38;lt; + 2 ( 2 topics &#124; 20 posts ) = 3 topics &#124; 25 posts&#60;br /&#62;
- Subforum2 ( 2 topics &#124; 20 posts )
&#60;/p&#62;</description>
</item>
<item>
<title>karaboga on "bbPress cannot count properly after upgrading"</title>
<link>http://bbpress.org/forums/topic/bbpress-cannot-count-properly-after-upgrading#post-11758</link>
<pubDate>Thu, 01 Nov 2007 09:07:05 +0000</pubDate>
<dc:creator>karaboga</dc:creator>
<guid isPermaLink="false">11758@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Thanks for the replies; I've upgraded the forum to the newest version 0.8.3, and then I've apply recounting. Now the problems I've stated in my first message are solved.
&#60;/p&#62;</description>
</item>
<item>
<title>sambauers on "bbPress cannot count properly after upgrading"</title>
<link>http://bbpress.org/forums/topic/bbpress-cannot-count-properly-after-upgrading#post-11013</link>
<pubDate>Thu, 20 Sep 2007 03:57:34 +0000</pubDate>
<dc:creator>sambauers</dc:creator>
<guid isPermaLink="false">11013@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;&#38;gt; Support Forums 1.2&#60;/p&#62;
&#60;p&#62;That's a really old version of Support Forums, not sure if it has anything to do with your problem, but it is really old.
&#60;/p&#62;</description>
</item>
<item>
<title>karaboga on "bbPress cannot count properly after upgrading"</title>
<link>http://bbpress.org/forums/topic/bbpress-cannot-count-properly-after-upgrading#post-10998</link>
<pubDate>Wed, 19 Sep 2007 08:12:26 +0000</pubDate>
<dc:creator>karaboga</dc:creator>
<guid isPermaLink="false">10998@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Thank you, I've understood the un-integrating issue.&#60;/p&#62;
&#60;p&#62;For the counting problems; these are the plugins we're using:&#60;/p&#62;
&#60;p&#62;Allow Images  	0.7.1&#60;br /&#62;
Avatar 	.73a&#60;br /&#62;
Memberlist 	.80&#60;br /&#62;
Censor 	0.1&#60;br /&#62;
Comment Quicktags for bbPress 	1.1&#60;br /&#62;
Front Page Topics 	0.8&#60;br /&#62;
Post Notification 	1.3&#60;br /&#62;
Online List 	1.4&#60;br /&#62;
Support Forums 	1.2&#60;br /&#62;
User Timezones 	0.2
&#60;/p&#62;</description>
</item>
<item>
<title>mdawaffe on "bbPress cannot count properly after upgrading"</title>
<link>http://bbpress.org/forums/topic/bbpress-cannot-count-properly-after-upgrading#post-10985</link>
<pubDate>Tue, 18 Sep 2007 18:41:06 +0000</pubDate>
<dc:creator>mdawaffe</dc:creator>
<guid isPermaLink="false">10985@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;The bb_users table will not be created automatically.  You'd have to copy it and the user meta tables from the WP ones.&#60;/p&#62;
&#60;p&#62;The counts problem is strange, and not one I've heard of before.  Do you any plugins installed?
&#60;/p&#62;</description>
</item>
<item>
<title>karaboga on "bbPress cannot count properly after upgrading"</title>
<link>http://bbpress.org/forums/topic/bbpress-cannot-count-properly-after-upgrading#post-10889</link>
<pubDate>Sun, 09 Sep 2007 08:24:33 +0000</pubDate>
<dc:creator>karaboga</dc:creator>
<guid isPermaLink="false">10889@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Hi again,&#60;/p&#62;
&#60;p&#62;We couldn't find any solution for that problem. If that's a bug; I hope it will be corrected in new versions.&#60;/p&#62;
&#60;p&#62;By the way, I'd said that we've integrated our bbPress forum to our WordPress blog. Now, forum users' data is taken from WordPress' wp_users table in database. And now, we do not have bb_users table.&#60;/p&#62;
&#60;p&#62;If we want to seperate bbPress from WordPress (cancel the integration); what can we do? If we cancel the integration; does the bb_users table created automatically?
&#60;/p&#62;</description>
</item>
<item>
<title>karaboga on "bbPress cannot count properly after upgrading"</title>
<link>http://bbpress.org/forums/topic/bbpress-cannot-count-properly-after-upgrading#post-10616</link>
<pubDate>Thu, 30 Aug 2007 16:50:36 +0000</pubDate>
<dc:creator>karaboga</dc:creator>
<guid isPermaLink="false">10616@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Thank you. Yes, I've tried that; but nothing changed.
&#60;/p&#62;</description>
</item>
<item>
<title>chrishajer on "bbPress cannot count properly after upgrading"</title>
<link>http://bbpress.org/forums/topic/bbpress-cannot-count-properly-after-upgrading#post-10614</link>
<pubDate>Thu, 30 Aug 2007 16:28:03 +0000</pubDate>
<dc:creator>chrishajer</dc:creator>
<guid isPermaLink="false">10614@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Did you try recounting from the admin panel?&#60;/p&#62;
&#60;p&#62;Admin &#38;gt; Site Management &#38;gt; Recount&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#38;quot;The following checkboxes allow you to recalculate various numbers stored in the database. These numbers are used for things like counting the number of pages worth of posts a particular topic has. You shouldn&#38;#39;t need to do do any of this unless you&#38;#39;re upgrading from one version to another or are seeing pagination oddities.&#38;quot;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;(sure wish blockquotes were styled here!)
&#60;/p&#62;</description>
</item>
<item>
<title>karaboga on "bbPress cannot count properly after upgrading"</title>
<link>http://bbpress.org/forums/topic/bbpress-cannot-count-properly-after-upgrading#post-10603</link>
<pubDate>Thu, 30 Aug 2007 13:33:37 +0000</pubDate>
<dc:creator>karaboga</dc:creator>
<guid isPermaLink="false">10603@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;We're using bbPress 0.8.2.1 integrated with WordPress 2.1.3. Before upgrading to 0.8.2.1 everything was ok. But after upgrading, something has broken.&#60;/p&#62;
&#60;p&#62;bbPress cannot count these values properly:&#60;/p&#62;
&#60;p&#62;- Numbers of topic and the messages of a member in his profile. (For example, a member who had 6 pages of messages in his profile, has only 1 page now)&#60;/p&#62;
&#60;p&#62;- Number of &#34;topics with no replies, topics with no tags, unresolved topics&#34; values are wrong. Each has less pages now.&#60;/p&#62;
&#60;p&#62;- In admin panel, the number of members is not accurate. bbPress says there 714 members; but this value is 6109 (this is the correct one) in WordPress.&#60;/p&#62;
&#60;p&#62;What can be the problem? I can tell the plugins we use, if necessary to solve the problem. Thanks!
&#60;/p&#62;</description>
</item>
<item>
<title>goebelmasse on "Wrong user count"</title>
<link>http://bbpress.org/forums/topic/wrong-user-count#post-10315</link>
<pubDate>Mon, 20 Aug 2007 14:22:35 +0000</pubDate>
<dc:creator>goebelmasse</dc:creator>
<guid isPermaLink="false">10315@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Oh, thank you SamBauers - this is the information missing on this site...&#60;/p&#62;
&#60;p&#62;But as I read at the trac site, the problem is already known. It is fixed by &#60;a href=&#34;http://trac.bbpress.org/changeset/872/branches/0.8?old_path=%2F&#38;#38;format=zip&#34;&#62;changeset 867&#60;/a&#62; - at least in my test environment. I'll upload it to the real server, it seems to be okay and of course it will be better than my quick and dirty &#34;solution&#34;...
&#60;/p&#62;</description>
</item>
<item>
<title>sambauers on "Wrong user count"</title>
<link>http://bbpress.org/forums/topic/wrong-user-count#post-10298</link>
<pubDate>Mon, 20 Aug 2007 03:36:50 +0000</pubDate>
<dc:creator>sambauers</dc:creator>
<guid isPermaLink="false">10298@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;I would not have that expectation unless you report a bug in the trac site.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://trac.bbpress.org&#34; rel=&#34;nofollow&#34;&#62;http://trac.bbpress.org&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Login with the same details you use here.
&#60;/p&#62;</description>
</item>
<item>
<title>goebelmasse on "Wrong user count"</title>
<link>http://bbpress.org/forums/topic/wrong-user-count#post-10297</link>
<pubDate>Mon, 20 Aug 2007 02:52:45 +0000</pubDate>
<dc:creator>goebelmasse</dc:creator>
<guid isPermaLink="false">10297@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Arrgh! Horrors!&#60;/p&#62;
&#60;p&#62;The problem is caused by the &#60;code&#62;bb_append_meta&#60;/code&#62; invocation in line 2075 of &#60;code&#62;functions.php&#60;/code&#62;.  The query destroys the last &#60;code&#62;SQL_CALC_FOUND_ROWS&#60;/code&#62; and so the count is wrong. A quick and dirty workaround is to change &#60;code&#62;'append_meta' =&#38;gt; false&#60;/code&#62; to &#60;code&#62;'append_meta' =&#38;gt; false&#60;/code&#62; in the &#60;code&#62;$defaults&#60;/code&#62; array in line 2021 of &#60;code&#62;functions.php&#60;/code&#62;.  But this only works if the append_meta argument is not given in the &#60;code&#62;bb_user_search&#60;/code&#62; call.&#60;/p&#62;
&#60;p&#62;Now the problem is more complicated as I suspected earlier. It is a problem for the hackers that make bbPress. No further searching for bugs from me, the problem should be clear. (It is clear enough to me after reading lots of code from other people.) I expect it to be fixed in the next release.
&#60;/p&#62;</description>
</item>
<item>
<title>goebelmasse on "Wrong user count"</title>
<link>http://bbpress.org/forums/topic/wrong-user-count#post-10295</link>
<pubDate>Mon, 20 Aug 2007 01:11:22 +0000</pubDate>
<dc:creator>goebelmasse</dc:creator>
<guid isPermaLink="false">10295@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;I found something that can help to fix this bug. In the following I use wordpress_ as prefix for my WP tables.&#60;/p&#62;
&#60;p&#62;My wordpress_usermeta table has 65 rows, and 65 users are displayed now in the bbPress dashboard. It seems to be a wrong SQL statement for querying the number of users.&#60;/p&#62;
&#60;p&#62;Instead of the (by me assumed) &#60;code&#62;select count(*) from wordpress_usermeta&#60;/code&#62; there should be used either &#60;code&#62;select count(*) from wordpress_users&#60;/code&#62; or &#60;code&#62;select count(distinct user_id) from wordpress_usermeta&#60;/code&#62; to get the number of users. &#60;/p&#62;
&#60;p&#62;(Oh yes, I know that there will be a where-clause...)&#60;/p&#62;
&#60;p&#62;I suspect line 2046 in &#60;code&#62;bb-includes/functions.php&#60;/code&#62;, but I'm not familar with the source.
&#60;/p&#62;</description>
</item>
<item>
<title>goebelmasse on "Wrong user count"</title>
<link>http://bbpress.org/forums/topic/wrong-user-count#post-10293</link>
<pubDate>Mon, 20 Aug 2007 00:47:31 +0000</pubDate>
<dc:creator>goebelmasse</dc:creator>
<guid isPermaLink="false">10293@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;I use bbPress 0.8.2.1 for a small forum. My user table is shared with a wordpress blog. My bbPress plugins are UseDisplayName 0.7.2, AllowImages 0.7.1, Private Forums 5.0, Forums Moderators 1.0, Google Analytics 0.68. I use the german localisation file, it is a german forum.&#60;/p&#62;
&#60;p&#62;There is a strange bug in the user list. At the moment, 8 users are registered. But the Users/Find admin panel displays a wrong number of users. It says there are 61 users.&#60;/p&#62;
&#60;p&#62;I took a screenshot a few days ago with six users, displayed as 48, if you don't understand the problem, &#60;a href=&#34;http://www.tamagothi.de/wp-content/uploads/2007/08/bbbug.gif&#34;&#62;take a look in my weird numbers&#60;/a&#62;. And I thought that reckoning is something a computer can do.&#60;/p&#62;
&#60;p&#62;Is the problem caused by one of my plugins, or by another reason? And is there a workaround? It is a bug that does not harm me now, but it is a strange one I do not understand.
&#60;/p&#62;</description>
</item>
<item>
<title>mazdakam on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-10102</link>
<pubDate>Fri, 10 Aug 2007 10:34:58 +0000</pubDate>
<dc:creator>mazdakam</dc:creator>
<guid isPermaLink="false">10102@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;:D _CK_ i could not udrestand what should i do you mean i found &#60;/p&#62;
&#60;p&#62;function get_view_count ( $topic_id )&#60;br /&#62;
and&#60;br /&#62;
function initialize_view_count( $topic_id )&#60;/p&#62;
&#60;p&#62;and put this line above them?&#60;br /&#62;
if (!$topic_id) return;
&#60;/p&#62;</description>
</item>
<item>
<title>_ck_ on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-10078</link>
<pubDate>Thu, 09 Aug 2007 15:48:20 +0000</pubDate>
<dc:creator>_ck_</dc:creator>
<guid isPermaLink="false">10078@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Ah I know what it is after studying the code a bit.&#60;br /&#62;
They never planned on  $topic_id being null or not set, so it's being inserted into the query as blank.&#60;/p&#62;
&#60;p&#62;mysql is getting something like&#60;br /&#62;
&#60;code&#62;SELECT meta_value FROM $bbdb-&#38;gt;topicmeta WHERE topic_id =  AND meta_key=&#38;#39;views&#38;#39;&#60;/code&#62;&#60;br /&#62;
see the blank before AND? It's unacceptable to mysql, needs to be a value.&#60;/p&#62;
&#60;p&#62;hack&#60;br /&#62;
&#60;code&#62;function get_view_count ( $topic_id )&#60;/code&#62;&#60;br /&#62;
and&#60;br /&#62;
&#60;code&#62;function initialize_view_count( $topic_id )&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;and make a new first line for each that says&#60;br /&#62;
&#60;code&#62;if (!$topic_id) return;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Should be a dirty workaround until the author can take a look.
&#60;/p&#62;</description>
</item>
<item>
<title>mazdakam on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-10073</link>
<pubDate>Thu, 09 Aug 2007 10:33:31 +0000</pubDate>
<dc:creator>mazdakam</dc:creator>
<guid isPermaLink="false">10073@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;i got this error too
&#60;/p&#62;</description>
</item>
<item>
<title>outchy on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-9370</link>
<pubDate>Thu, 26 Jul 2007 13:53:54 +0000</pubDate>
<dc:creator>outchy</dc:creator>
<guid isPermaLink="false">9370@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;this works really well on the front page, although i'm having a slight issue with my dashboard.  when this plugin is active, i get the following error text on the right-hand side:&#60;/p&#62;
&#60;p&#62;Recently Moderated&#60;/p&#62;
&#60;p&#62;* Post on&#60;/p&#62;
&#60;p&#62;bbPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND meta_key='views'' at line 1]&#60;br /&#62;
      SELECT meta_value FROM bb_topicmeta WHERE topic_id = AND meta_key='views'&#60;/p&#62;
&#60;p&#62;bbPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 'views', )' at line 1]&#60;br /&#62;
      INSERT INTO bb_topicmeta ( meta_id, topic_id, meta_key, meta_value) VALUES ( NULL , , 'views', )&#60;br /&#62;
      Welcome to SK6Fans.com by neddi.&#60;/p&#62;
&#60;p&#62;Here is a &#60;a href=&#34;http://www.manonfire.cc/images/errortext.png&#34;&#62;screenshot&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Any thoughts?
&#60;/p&#62;</description>
</item>
<item>
<title>_ck_ on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-9276</link>
<pubDate>Tue, 24 Jul 2007 16:22:30 +0000</pubDate>
<dc:creator>_ck_</dc:creator>
<guid isPermaLink="false">9276@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;I've now come up with an extremely easy/fast way to grab and display the views per forum in the forum list on the front page (or forums with sub-forums.&#60;/p&#62;
&#60;p&#62;Here's the plugin:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;function forums_views_append($forums) {
global $bbdb; $sum_meta_value=&#38;quot;SUM(meta_value)&#38;quot;;
$forums_views = $bbdb-&#38;gt;get_results(&#38;quot; SELECT $sum_meta_value,forum_id FROM $bbdb-&#38;gt;topicmeta LEFT JOIN $bbdb-&#38;gt;topics ON $bbdb-&#38;gt;topicmeta.topic_id = $bbdb-&#38;gt;topics.topic_id  WHERE $bbdb-&#38;gt;topicmeta.meta_key=&#38;#39;views&#38;#39;  GROUP BY $bbdb-&#38;gt;topics.forum_id&#38;quot;);
foreach ($forums_views as $forum_views) {$forums[$forum_views-&#38;gt;forum_id]-&#38;gt;views=$forum_views-&#38;gt;$sum_meta_value; }
return $forums;
}
add_filter(&#38;#39;get_forums&#38;#39;,&#38;#39;forums_views_append&#38;#39;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;To display the views, edit your front-page.php template and insert a views header and views column like so:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;th&#38;gt;&#38;lt;?php _e(&#38;#39;Views&#38;#39;); ?&#38;gt;&#38;lt;/th&#38;gt;
	&#38;lt;th&#38;gt;&#38;lt;?php _e(&#38;#39;Topics&#38;#39;); ?&#38;gt;&#38;lt;/th&#38;gt;
	&#38;lt;th&#38;gt;&#38;lt;?php _e(&#38;#39;Posts&#38;#39;); ?&#38;gt;&#38;lt;/th&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;.&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;td&#38;gt;&#38;lt;?php echo $forum-&#38;gt;views; ?&#38;gt;&#38;lt;/td&#38;gt;
	&#38;lt;td&#38;gt;&#38;lt;?php forum_topics(); ?&#38;gt;&#38;lt;/td&#38;gt;
	&#38;lt;td&#38;gt;&#38;lt;?php forum_posts(); ?&#38;gt;&#38;lt;/td&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Since there is no clean way to store forum meta data right now in bbpress (apparently an oversight) this will run on every time the forums list is displayed. Maybe not such a good idea for very busy forums, even though it's a single mysql query (nifty eh?).&#60;/p&#62;
&#60;p&#62;Eventually I'll figure out a nice way to store this and only update upon new posts or new topics to reduce overhead (or a cron job perhaps).
&#60;/p&#62;</description>
</item>
<item>
<title>_ck_ on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-9220</link>
<pubDate>Sun, 22 Jul 2007 13:38:51 +0000</pubDate>
<dc:creator>_ck_</dc:creator>
<guid isPermaLink="false">9220@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Here's a plugin to extend the topic-views plugin and add a &#34;most-views&#34; view page (ie. view.php?view=most-views)&#60;/p&#62;
&#60;p&#62;It does it with a minimum number of mysql calls, just 10 to display an entire page on my setup. You have to hack your views.php template to add the views column,  use $topic-&#38;gt;views for the view count to use the cached data in memory instead of an extra mysql query for each topic.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function most_views_views( $views ) {
	global $views;
	$views[&#38;#39;most-views&#38;#39;] = &#38;#39;Topics with the most views&#38;#39;;
	return $views;
}
add_filter(&#38;#39;bb_views&#38;#39;, &#38;#39;most_views_views&#38;#39;);

function most_views( $view ) {
global $bbdb, $topics, $view_count;
switch ( $view ) :
case &#38;#39;most-views&#38;#39; :
$limit = bb_get_option(&#38;#39;page_topics&#38;#39;);
$where = apply_filters(&#38;#39;get_latest_topics_where&#38;#39;,&#38;#39;&#38;#39;);
$most_views = $bbdb-&#38;gt;get_results(&#38;quot;SELECT topic_id FROM $bbdb-&#38;gt;topicmeta WHERE meta_key=&#38;#39;views&#38;#39; ORDER BY cast(meta_value as UNSIGNED) DESC LIMIT $limit&#38;quot;);
foreach (array_keys($most_views) as $i) {$trans[$most_views[$i]-&#38;gt;topic_id] =&#38;#38; $most_views[$i];} $ids = join(&#38;#39;,&#38;#39;, array_keys($trans));
$topics =&#38;quot;SELECT * FROM $bbdb-&#38;gt;topics WHERE topic_id IN ($ids) $where ORDER BY FIELD(topic_id, $ids)&#38;quot;;
$topics = $bbdb-&#38;gt;get_results($topics);
$view_count  = count($topics);
$topics = bb_append_meta( $topics, &#38;#39;topic&#38;#39; );
	break;
default :
	do_action( &#38;#39;bb_custom_view&#38;#39;, $view );
endswitch;
}
add_action( &#38;#39;bb_custom_view&#38;#39;, &#38;#39;most_views&#38;#39; );&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>_ck_ on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-9216</link>
<pubDate>Sun, 22 Jul 2007 10:51:44 +0000</pubDate>
<dc:creator>_ck_</dc:creator>
<guid isPermaLink="false">9216@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;The topic metadata is returned with every set of topics returned to bbpress.&#60;/p&#62;
&#60;p&#62;In the front page (or any topic page) for example, in the loop it can be found as $topic-&#38;gt;views&#60;/p&#62;
&#60;p&#62;There is no need for an extra mysql query. It's possible to make a function that's called with $topic if you don't want to do it as simple as above.
&#60;/p&#62;</description>
</item>
<item>
<title>cweb on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-8793</link>
<pubDate>Mon, 09 Jul 2007 19:34:56 +0000</pubDate>
<dc:creator>cweb</dc:creator>
<guid isPermaLink="false">8793@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Hrmmm, I just installed the plugin, reviewed the steps a few times to make sure I was correct.  My view count hasn't been incrementing at all, stays fixed at the Post count.  In fact, today a few View counts have actually decremented from the Post count, weird.  Seems like a simple enough plugin, did I miss some setup with the database?
&#60;/p&#62;</description>
</item>
<item>
<title>HowToGeek on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-8097</link>
<pubDate>Fri, 15 Jun 2007 20:20:59 +0000</pubDate>
<dc:creator>HowToGeek</dc:creator>
<guid isPermaLink="false">8097@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;fel64: I'd think that's the best way to handle it for normal usage.&#60;/p&#62;
&#60;p&#62;Personally, I moved that functionality into a memcached module... not entirely useful for regular installs.
&#60;/p&#62;</description>
</item>
<item>
<title>fel64 on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-8081</link>
<pubDate>Fri, 15 Jun 2007 10:46:23 +0000</pubDate>
<dc:creator>fel64</dc:creator>
<guid isPermaLink="false">8081@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;I suppose you could make the variable static, meaning it'll be the same every time that function is called, and then check if there's already something in it before you do the query again. Your query would then be selecting the thirty topics last posted in, of course.
&#60;/p&#62;</description>
</item>
<item>
<title>wittmania on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-8077</link>
<pubDate>Fri, 15 Jun 2007 01:38:12 +0000</pubDate>
<dc:creator>wittmania</dc:creator>
<guid isPermaLink="false">8077@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;I'm open to suggestions... since it's not part of the $topic global, but rather in the topicmeta table, that's the only way I could think to do it.&#60;/p&#62;
&#60;p&#62;It works as it is, but if you've got a better idea as to how it could work better, I'm all ears.
&#60;/p&#62;</description>
</item>
<item>
<title>HowToGeek on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-7958</link>
<pubDate>Sun, 10 Jun 2007 06:06:34 +0000</pubDate>
<dc:creator>HowToGeek</dc:creator>
<guid isPermaLink="false">7958@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;One issue with this plugin is that it does a separate SQL call for every single topic on the page.... that's 30 unnecessary SQL calls per topic list view.&#60;/p&#62;
&#60;p&#62;You might want to take a look at that...
&#60;/p&#62;</description>
</item>
<item>
<title>wittmania on "Plugin: bb-Topic-Views"</title>
<link>http://bbpress.org/forums/topic/plugin-bb-topic-views#post-7781</link>
<pubDate>Thu, 31 May 2007 22:28:06 +0000</pubDate>
<dc:creator>wittmania</dc:creator>
<guid isPermaLink="false">7781@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;OK... it is now available through &#60;a href=&#34;http://bbpress.org/plugins/topic/53&#34;&#62;the plugin browser&#60;/a&#62;!
&#60;/p&#62;</description>
</item>

</channel>
</rss>
