HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

How to show a Discussion has read or unread posts in it?

So I am looking at my forum and I am using the plugin that shows unread category icon to show if that category has any unread Discussions or Comments..

Problem is how can you tell a Discussion has unread comments? Everything is bold there are no NEW tags on anything. Is there a way to have its so like this site it shows up bold is unread and not bold is read?

Comments

  • Options

    It looks like this forum is using the CSS style .Unread to show Discussions that have unread comments. Any ideas how i can add this to my Theme? I am just not sure how I would inject this .Unread CSS tag into the page so i can apply the CSS on only Unread Discussions

  • Options

    NM I didn't look high enough to see .UNREAD or .READ it has been applied to the LI above the item

  • Options
    MrCaspanMrCaspan
    edited April 2020

    this deprecated function public function getUnread() is BROKEN... the table structures seem like they have changed. So if its 100% broken why is it still in the code? We have a small forum and i get it does not scale but if you can get the fact that there are unread message for a category that is doing the same leg work now? It would be nice to have this as a plugin. If only i know how Vanilla determines what a user has read or not

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Look at the UserDiscussion table: the crucial information is the DateLastViewed column.

    If there are no lines in UserDiscussion for sessionUserID and discussionID, then everything is unread.

    If there are newer comments in the Comment table than the DateLastViewed date from the UserDiscussion, than there are unread comments. You can count the newer comments to get the number of unread comments.

  • Options

    Yeah I am getting weird stuff happen all over the forum with Categories that say they are read but once you go in there is unread discussions in it and Categories that say there are unread messages and there are none.. I wonder if something about the import messed up something.

  • Options

    That whole table is weird, attached is a dump of it.. all it has in it is userID 2 for everything..



  • Options
    MrCaspanMrCaspan
    edited April 2020

    So just so i understand this correctly

    If i look at UserCategory there is my userID in there and the categories that I marked as read and a date stamp that i did that.. So if a new comment or new discussion gets added that is after that DateMarkedRead then the category must have unread messages in it. I am assuming that every time the category page is loaded it uses my userID to figure that out for each category?

    So if I mark the category as read I am assuming it would update the date in this table for that category but is it suppose to also mark all the discussions in that category as read?

  • Options
    MrCaspanMrCaspan
    edited April 2020

    So I answered my own question.. Looks like this is the code that runs when you click on the "Mark Read" link from the gear, So this does nothing to Discussions or Comments..

      public function markRead($categoryID, $tKey) {
        if (Gdn::session()->validateTransientKey($tKey)) {
          $this->CategoryModel->saveUserTree($categoryID, ['DateMarkedRead' => Gdn_Format::toDateTime()]);
        }
        if ($this->deliveryType() == DELIVERY_TYPE_ALL) {
          redirectTo('/categories');
        }
    
        $this->render();
      }
    

    So is it possible to mark a Category as read and all it does is change the view of the category and if i open up the category i will still find unread Discussions in there? Sorry for so many questions.. but after an hour I keep poking around and find stuff :)

  • Options
    MrCaspanMrCaspan
    edited April 2020

    I just realized that that attachment I gave you was not a full table dump. that's actually only like the first 400 records..

    Okay so now I understand how this works, I thought that a category would show unread because a calculation was done to see if there was any unread comments/discussions inside of it which is kind of true basically it check to see the last date something was posted to discussions or comments and if that date is greater then the one set on the category then there must be new items... to see

    But is is possible to Mark a category as read but the Discussions inside will still show that there are unread comments/discussion on this item. Man that is really confusing! Marking a category read should mark all discussions beneath that category. why would someone only want to only mark the category as read but leave the discussions showing unread counts.


    So basically what i need to do is write a function that will allow me to mark every single discussion/comment as read then remove the mark read option from categories then the only way for a forum to be read is if they actually read the discussion thats not read. Either that change the code in Mark Read for the category to go through all Discussions/Comments under that category and mark them as read

  • Options

    So here is the problem... I went through and marked all discussions in a category read i just got a notification that there was a new post and I read the new post, Category still shows new posts in it!!

Sign In or Register to comment.