bbPress Plugin Browser »

bb Topic Views (1.6.4)

Download

Version: 1.6.4

Last Updated: 2009-2-6

Requires bbPress Version: 0.8 or higher

Compatible up to: 0.9

Author Homepage »

Plugin Homepage »

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(7)

Your Rating

Authors _ck_, wittmania


  1. ganzua, in this case an extra table unnecessary as it's a simple number count and the meta is already there - why would you delete a topic's count without deleting the topic and visa versa? A seperate table would also require an extra query for every page.

    I show it working fine in the trunk.
    Given how many people use the alpha despite my warnings, we'd be hearing from many, many more people if it stopped working entirely for everyone.

    Let's take a look at what's unusual about your setup? Windows? Integrated? Separate database?

    Keep in mind the view count is session based for each topic, you have to go view ANOTHER topic and then go back to the first topic to see an increase. It won't go up on every page load.

    Posted: 3 years ago #
  2. Hi! Ck

    My setup is a wp2.7 integration with 1.06a. I actually tested in both, a windows server (my local installation) and a live site that is in a linux server. Count doesn't increase. I checked those 'view' fields and all stay at 1.

    an extra table unnecessary as it's a simple number count and the meta is already there - why would you delete a topic's count without deleting the topic and visa versa?

    If you have a 30.000 topics forum you are going to fill bb_meta table with 30.000 'view' fields.

    I suggested a new table while thinking in removing the plugin :) but when I first started to look what this plugin was doing to the database, I searched in bb_topics table. I expected to find a new topic_views field there. Might it be a better place for those view fields? topic_id, topic_title, topic_slug, topic_poster...topic_views?

    Posted: 3 years ago #
  3. You can't go modifying the core database tables.
    That's the compromise with the extendability of bbPress.

    Of course someone designing a forum from scratch would include a field for view counts but when Matt designed it, he didn't bother and here we are. If only that was bbPress's worst problem.

    I agree it's less efficient, but I'm not triggering an extra query for every topic load.

    mysql has to scan the meta for every page load anyway, might as well put it there.

    As far as why yours is failing to update, I would bet you have a custom theme that's not executing the bb_head action hook.

    When you make a custom theme you must match the hooks in the default templates or many plugins will not work.

    Edit your header.php and make sure near the end it looks like this:

    <?php bb_head(); ?>
    </head>

    If you don't have the bb_head, that's your entire problem.

    Posted: 3 years ago #
  4. (removed, see above)

    Posted: 3 years ago #
  5. You can't go modifying the core database tables.
    That's the compromise with the extendability of bbPress.

    Oops, I didn't say anything then.

    As far as why yours is failing to update, I would bet you have a custom theme that's not executing the bb_head action hook.

    That was very helpful, thanks :) You're right. I didn't have bb_head because I integrated with wp, I'm using wp headers and nobody said that after deep integration you need to call the bbpress header. I keep on thinking Matt should re-direct some resources to create a bbpress codex.

    I tested again and now the plugin works. However I called the header with a conditional, you know; if this is bbpress then load bb_head, just in case it hurts wordpress installation. Does it hurts?

    Posted: 3 years ago #
  6. BTW, does this plugin have any function to sum up all the views? I'm trying to add all hits bbpress recieves to my wp hit counter.

    Posted: 3 years ago #
  7. Well if you are missing bb_head I bet you are missing bb_foot too and other plugins need that so make sure that's there in footer.php also.

    Keep in mind it's not a true page view counter but you can get a total views by summing the column.

    global $bbdb;
    $total_views=$bbdb->get_var("SELECT SUM(meta_value) FROM bb_meta WHERE object_type='bb_topic' AND meta_key='views'");
    Posted: 3 years ago #
  8. Well if you are missing bb_head I bet you are missing bb_foot too

    Absolutely :) Thanks for the code

    Posted: 3 years ago #
  9. bedbugger

    Member

    I am using the plugin. Something odd is suddenly happening. One thread is not counting views, only posts. And it's currently showing 1 view and 11 posts (impossible, right?) This is the forum: http://bedbugger.com/forum/

    It's the thread entitled, "Bite primer-- information on bites and reactions".

    Would welcome any feedback!

    Posted: 3 years ago #
  10. bedbugger

    Member

    And I should add, other posts are STILL calculating views properly...

    Posted: 3 years ago #
  11. bedbugger

    Member

    And I should add, other posts are STILL calculating views properly...

    Posted: 3 years ago #
  12. The plugin initializes the number of views to the number of posts when it determines a topic does not have a view count yet.

    So if the topic keeps only showing the number of posts as the number of views that may mean something is corrupted.

    Are you running bbPress 0.9 or 1.0 - did you change anything recently?

    If you have phpmyadmin and know how to use it, you can search in bb_topic_meta for the views meta for that topic number and delete it - then it should recount it.

    But very strange it's not updating. Maybe sessions are temporarily broken on your server and it needs to be restarted?

    Update: it occurs to me that one way this could happen is if there are multiple entries in the bb_topic_meta for the same topic, for views. This means one of them is being updated, the other isn't, and the one that is not being updated is being displayed. Technically this is possible but should never happen. PHPmyadmin would be able to confirm this suspicion.

    Posted: 3 years ago #
  13. I've now posted 1.6.4 which will cleanup any entries in the db with a value of zero during activation. This should fix the bug in the short term but doesn't solve the original bug that I have to track down.

    So install 1.6.4
    Then deactivate it.
    Then re-activate it.

    And then the view counters should start increasing again for "stuck" values.

    Posted: 3 years ago #
  14. djeelo

    Member

    Hello all,

    Here is my little problem...
    I've well integrated this plugin in my forum (as a new column).

    Everything goes well except the size of the view_count column... It seems to be a not fixed value and it destroy all the front_page structure.
    I'm not so good in css but it should exist a value to modify this to a fixed size ...

    here is my forum : http://soab.beachdays.net
    I'm using 9.0.4.

    Thanx a lot for answers.

    And excuse my not so good english.

    Have a nice day !

    djeelo

    Posted: 3 years ago #
  15. Hey CK et al,

    Love this plugin but something weird just happened (Running RC2 btw)

    All my new topics have been having their views update, but all of a sudden someone started a topic and its stuck at '1 views'.

    No clue why this happened.

    Here it is if you want to look:

    National Energy Tax: Where does the PA Congressional Delegation Stand? (1 views)

    http://newstalkpa.com/ (Should be near the top)

    Posted: 2 years ago #
  16. For my plugins, RC1 & RC2 (and 1.0 in general) is not supported until December.

    Posted: 2 years ago #
  17. Thanks for the heads up _ck_.

    Weird thing...For some reason the plugin showed '1 views' for the first 99 views but once the number of views passed 100 it started showing the correct number of views again.

    Crazy, huh???

    Posted: 2 years ago #
  18. Keep in mind the plugin uses sessions to track a topic view.
    If you view the topic, then go out of the topic, then back in, it won't increase.
    If you refresh the top 100 times it won't increase.
    It only count if you leave the topic and go to another topic and then come back to the topic.
    Or if you go away long enough for the session to time out.

    Posted: 2 years ago #
  19. bb-gian

    Member

    Hi _CK_,

    I am having a problem with the plugin.

    I run bbpress 1.0.1 and I installed bb Topic Views (1.6.4).

    Now, I've put <th><?php _e('Views'); ?></th> and <td><?php echo $forum->views; ?></td> at the right places in orde to add the Views column.

    Thing is that no value shows in the Views column.
    I got the values displaying right after the Topic name like so: This is my topic (2 views). I know this is the default setting but:

    1) I'd like to have the values dispaying in the column
    2) I don't want them to appear after the Tipic title (it's odd to have it twice).

    Oh, I got the <?php bb_head(); ?> in header.php

    Any help?

    Posted: 2 years ago #
  20. bb-gian

    Member

    Oh, I didn't put the "plugin" code anywhere:

    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 should I put it?

    Posted: 2 years ago #

RSS feed for this topic

Add a Comment »

You must log in to post.