Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Discussion views count is incremented every time I open the discussion...

lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

...whitout handling my recurring visit as the same user. The views count (of a discussion) should be incremented only at my first visit, I think.

Browsing applications/vanilla/settings/class.hooks.php I saw that in the function Gdn_Statistics_Tick_Handler this line is called every time $DiscussionModel->AddView($DiscussionID); without considering session, etc.

Is this a current limit of vanilla or a bug?

Thank you.

There was an error rendering this rich post.


  • 422422 Developer MVP

    Isnt it related to vanilla analytics

    There was an error rendering this rich post.

  • I think it has to do with the concept. some people want it one way and some another. It is all semantics. how a view counter is setup

    by brower views
    by views by an ip
    what if two people share the same ip address - should that be counted as two views or one.
    To me its a sticky thicket, and you never mentioned the version pf vanilla, maybe they work differently.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

    Probably is my fault: I'm using VF 2.1a36 online for a production website (still a few users). But now I see that my local version isn't "affected" by this problem. I'm investigating...

    There was an error rendering this rich post.

  • lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

    I cloned online files and database to a localhost env, and here all works correctly (?): views counter remain the same after each visit.

    Anybody that can explain how discussions views count works (ip, guest, logged users...)?

    Thank you.

    There was an error rendering this rich post.

  • hgtonighthgtonight ∞ · New Moderator
    edited March 2013

    Considering you are using alpha software, the code is pretty much the only documentation available. :)

    Look at /applications/vanilla/models/class.discussionmodel.php around line 1808. You should see a function called AddView.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.