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.

count of views of discussion.

One who visit his/her own discussion, the count of discussion views are increased. I think this is not fair. Consider I post a discussion( question ) and visit it. Then the count of views is labelled as 1. If I visit 10 times ( for example ) the same discussion the count of views become 11. This approach gives that we think our discussion is visited 11 times by others. But actually the visitors are ourselves. So I propose that it does not increment the count of views if the question owner visit his question. So from this we can realize that our question is reached to others.



  • Options
    hgtonighthgtonight ∞ · New Moderator

    What about someone that views their own discussion once replies have been posted? Does that view not count?

    It is definitely a preference thing. You could probably come up with a unique visitor count without storing any extra data. The data would be in the UserDiscussion table. Count the number of records for a specific DiscussionID to get the number of unique registered users.

    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.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    It would need an extra column in the Discussion table to track "unique" visits - maybe something like

        'CountComment' => 0,
        'UserIDs' => array (1, 9, 13,...)

    You would have to compare CountComment to $Discussion->CountComment and
    a) either overwrite the current entry in your custom column with UserIDs = current user and set CountViews column in Discussion to 1 or
    b) add current userid to the array (if it is not already in there) and update the CountViews column in Discussion to the number of unique views

    No big thing, I'd say ;)

    The only real bad thing is that you most probably have to overwrite core files: I think the incrementation is done in DiscussionModel::AddView and that is called in Gdn_Statistics_Tick_Handler? So you would have to change /applications/vanilla/settings/class.hooks.php to change the function call.
    Maybe calling Gdn_Statistics_Tick_Handler in your plugin and simply overwrite the info in CountViews based on the functionality of your plugin would help. You would have to try that...

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Ah no - you would have to add your CountComment to $Discussion->CountComment and if that info is overwritten at some point, you'll need to store your value also at another field.

    Well, maybe it is not as easy as I thought at first. But only counting unique views is not the behaviour users are used to.

  • Options

    I don't mean it should count the unique views only. But it should count all the visit of all user except the question owner.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Well, I assume it could be done and if you start writing such a plugin, I'd help as good as I can, but I think that this is no great information. What would be the benefit of not showing the discussion openers views? You say it is "not fair", but users are not rewarded by view count.

  • Options

    ok, i just say a suggestion in my point of view. leave it. :smile:

Sign In or Register to comment.