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.
Question regarding UserDiscussion.DateLastViewed
viziona
New
I am creating plugin which will show list of all discussions with unread comments.
My code looks like this:
the problem that I am facing is that even if I open Discussion, the DateLastViewed field is not always updated
(possibly related to problem my installation has: http://vanillaforums.org/discussion/12903/datelastcomment-not-updateds)
Can someone reproduce this misbehavior?
Is there more preferred way to get unread discussions?
thanks
My code looks like this:
return $Sender->SQL->Select('d.*')
->Join('UserDiscussion ud','d.DiscussionID = ud.DiscussionID and ud.DateLastViewed < d.DateLastComment')
->Where(array (
'ud.UserID' => $UserID,
))
->Limit($Limit, $Offset)
->Get();
the problem that I am facing is that even if I open Discussion, the DateLastViewed field is not always updated
(possibly related to problem my installation has: http://vanillaforums.org/discussion/12903/datelastcomment-not-updateds)
Can someone reproduce this misbehavior?
Is there more preferred way to get unread discussions?
thanks
0
Comments
I think that you should select the ones with dates less than or null, and/or maybe check the comment count as well compared to the full number of comments for that discussion.
Maybe a core dev might have some more insight about this.
will report once I check this live
->Join('UserDiscussion ud', 'd.DiscussionID = ud.DiscussionID and (d.CountComments - ud.CountComments) >0 ')
I'll cleanup some code and upload the plugin to Addons