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.

How to edit forum thread view count?

I want to edit it/reset it back to 1. How do I do this?

Comments

  • peregrineperegrine MVP
    edited November 2014

    use phpmyadmin for example

    the Discussion Table - the field is Countviews

    for discussion number 141

    UPDATE `GDN_Discussion` SET `CountViews` = '1' WHERE `DiscussionID` =141;
    

    if you take out the where it will update ALL discussions to a count of 1

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

  • Thank you, I did as you said and it worked.

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    I have a need that I'm not sure is unique - to prime several categories with discussions. I discovered that admins/moderators editing and reviewing these posts ramp up the views counts.

    So I wonder whether it is possible to reset the counts when a moderator decides that some posts are "final" and ready for the audience.

    Is this a phpadmin function similar to what was suggested above or more of a plugin type of solution?

  • hgtonighthgtonight ∞ · New Moderator
    edited July 2015

    @rbrahmson said:

    Is this a phpadmin function similar to what was suggested above or more of a plugin type of solution?

    If it is something you are going to do often, make a plugin.

    If it is a once or twice kind of thing, use a straight db query.

    EDIT - Remember that you don't have to release any plugins to the public. I have plenty of niche plugins in use around the web that I don't release here. They aren't polished enough or useful enough for a broad audience to use. Doesn't stop them from being useful to me. :)

    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.

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    OK, thanks @hgtonight. So it's probably a plugin which I won't share (I'm learning the forum etiquette;-). I got the plugin template and many other plugins I could potentially use as a basis. Ready to roll up my sleeves, but still don't know how to proceed. Which plugin to model after, which functions to call, where, etc.

  • hgtonighthgtonight ∞ · New Moderator

    @rbrahmson said:
    OK, thanks hgtonight. So it's probably a plugin which I won't share (I'm learning the forum etiquette;-). I got the plugin template and many other plugins I could potentially use as a basis. Ready to roll up my sleeves, but still don't know how to proceed. Which plugin to model after, which functions to call, where, etc.

    Feel free to share it if you want feedback. :)

    If you don't like reading source code, check out the Event plugin to find hooks to use. And check out my Testing Ground plugin for some basic information on the structure of a plugin.

    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.

  • BleistivtBleistivt Moderator

    Using the SQL builder is dead simple. What peregrine posted above would translate to

    Gdn::sql()
        ->update('Discussion')
        ->set('CountViews', 1)
        ->where('DiscussionID', 141)
        ->put();
    
  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭
    edited July 2015

    Thanks @Bleistivt - I think Plugin would work better if I need to give this function to moderators...
    @hgtonight - Yes, I got your Testing Ground. Will get the Event (did you mean Eventi?) plugin as well and play with it next week. My coding experience is really from University too many years ago (if you call PL1 a programming language;-) but surprisingly I found some plugin code readable...

  • R_JR_J Ex-Fanboy Munich Admin

    I would add it to the discussion options: "Reset ViewCount" or something like that with the code Bleistivt provided. You can use the Bump plugin as a blueprint

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Thanks guys (and/or Gals-I mean to include everyone), I'll give it a shot!

Sign In or Register to comment.