View Full Version : Number of Unread Posts per Thread?
Cedric_FP
03-07-2014, 09:19 AM
Hello,
I am interested in implementing functionality like the Something Awful forums where, after a user has read a thread, the "go to first new post" button also reads out the *number* of unread posts.
Is this possible? So far, all I know is that this is the go to first new post button code:
<vb:if condition="$show['gotonewpost']"><a href="{vb:link thread, {vb:raw thread}, {vb:raw pageinfo_newpost}, 'threadid', 'threadtitle'}" id="thread_gotonew_{vb:raw thread.realthreadid}"><img class="gotonewpost" src="{vb:stylevar imgdir_button}/firstnew.png" alt="{vb:rawphrase go_to_first_new_post}" /></a>
</vb:if>
Is there like a short code I can use to display, in text next to the image, the number of new unread posts in that thread? Something like:
<vb:raw threadinfo_unreadpostscount>
I just made that up, I know it doesn't exist. But I am totally unsure if this functionality is even built into VB4.
Thank you so much in advance for any help you can provide.
tbworld
03-07-2014, 09:44 AM
I have really never looked into it, so I am waiting for other experts on the vbulletin.org to chime in. There is this modification that may give you some insight into the process.
Display Unread Posts (and Reputation Comments in 4.1)
https://vborg.vbsupport.ru/showthread.php?t=231060&page=4
If no one replies, then I will revisit the question for you. :)
Cedric_FP
03-11-2014, 01:44 PM
I have to be honest, I can't find anything in that plugin to use as a template call for unread post count per thread. Perhaps it's something that is not even tracked?
tbworld
03-11-2014, 03:32 PM
For posts in a thread, a record of the last post read in the thread, by the user, would have had to been stored. Looking at the database tables I do not see anything that can be used to derive it and unfortunately the way vb handles unread posts does not get us there either. It might be possible to extract recent read post information from the activity stream, but I have to ponder that some more when I have a fresh brain. :)
Sorry, for the bad news, it would have been nice if it was easily possible.
Cedric_FP
03-12-2014, 03:04 AM
Thanks for the help anyway, tbworld :)
cellarius
03-12-2014, 10:42 AM
vB stores read/unread-information as a timeline per thread per user, i.e. it safes the time the user last looked at the thread. One would have to get that time, then count all posts in the post table that have been posted to a said thread after that time. Since this would have to be done with every load of showthread, it has the potential to add a lot of additional strain on the database, especially the post table. It probably is possible, but I would definitely advise against it.
tbworld
03-13-2014, 12:08 PM
Thanks @cellarius! Very nicely worded.
I have to quit doing research at 4am, for some reason I completely overlooked the 'post' table. I did conclude that on a busy board the extra server load, might not make this feasible, but at least now it is possible. Thanks again for the input. :)
@Cedric FP, I will add this to my backlog and take a further look at this when I have time.
Cedric_FP
03-15-2014, 07:38 AM
Thanks cellarius. Though my ability to write something like that is severely limited, I will try to give it a go anyway. The server load is a good point. I wonder if it is possible to only have it count the unread posts of someone who has already visited the thread at least once. That way, it partially acts as a thread subscription.
@tbworld - thanks. I would greatly appreciate any further help on this issue.
Edit: I wonder if there is any similar functionality built into the thread subscription system?
cellarius
03-15-2014, 02:50 PM
I wonder if it is possible to only have it count the unread posts of someone who has already visited the thread at least once.
Of course you would only count for users that have already visited the thread once. Only for users that have visited the thread before an entry exists in the threadread table.
That way, it partially acts as a thread subscription.
Partially.
Edit: I wonder if there is any similar functionality built into the thread subscription system?
No. The thread subscription system uses the same data as the unread posts system.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.