Skip to:
Content
Pages
Categories
Search
Top
Bottom

Views plugin help needed

  • @wittmania

    Member

    I am working on a “Topic Views Count” plugin, and I’m just about finished with it. You can see a working version of it here: http://blog.wittmania.com/bbpress/, and see the source code as it is right now here: http://blog.wittmania.com/files/bb-topic-views.txt

    The only thing holding me up is this; I can’t figure out a way to keep the views count from including page views. For example, when page one of a topic loads, the view count will go up by one. But, when page two loads it will also go up by one. So, a visitor has only viewed the topic once (albeit they’ve viewed more than one page), but the counter has registered two views).

    I know this isn’t a huge deal, and a counter that over-counts is better than no counter at all. Still, I was wondering if anyone would have any ideas. I’d like to avoid using cookies, if possible, because I have no experience with them at all to even know where to start.

    Any ideas? I’m also open to any other ideas or suggestions for the rest of the code.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • @fel64

    Member

    I’m not sure how it’s handled, but it might be worth looking at how phpBB or vBulletin or any other forum software does it.

    @wittmania

    Member

    Got it figured out! I studied up on how to use session variables, and that gave me the answer I was looking for. By passing the “last topic ID” variable, I could check to see if it matched the “current topic ID” variable. If it matches, it leaves the record alone. If it’s different, it adds a tick to the counter.

    The post for the completed plugin is here:

    https://bbpress.org/forums/topic/1121

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar