phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

How are unread topics tracked?


 
Search this topic... | Search phpBB2 Discussion... | Search Box
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Author Message
kali
Board Member



Joined: 26 Nov 2013

Posts: 7
Location: Berlin (Germany)


flag
PostPosted: Mon Nov 13, 2017 7:37 pm 
Post subject: How are unread topics tracked?

My issue: all of a sudden, some topics don't get the "new messages" mark lost when i read the topic. Strange enoguh, some do, some don't. I haven't quite figured out what connects those who don't. I thought it was related to the fact my forum config didn't get the DST change on time (I mean, I did not make the config change manually because I forgot I had to), but then I realized that some of the "won't get marked as read" topics have messages from a couple days ago, so my initial guess of "this is because the newest message is in the future" doesn't explain it.

So for the savvy people around, I'd like to know how does phpbb2 track unread topics. For what I've seen in the code it must be something in the session cookie (which explains why, when logged out, all messages are marked as read).

Any help is really appreciated.

Also, I believe this is my first post here, or at least one of the first ones. So Hello world!
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Tue Nov 14, 2017 1:03 pm 
Post subject: Re: How are unread topics tracked?

Hey there icon_smile.gif

What I like to do when something breaks unexpectedly without me changing anything is check if my host recently upgraded PHP or SQL or changed any of the default configuration. Looking for the code in viewforum.php, one thing I would suspect is the use of $HTTP_COOKIE_VARS since it has long been deprecated and superglobals can be turned off. But since you're only seeing the odd behavior on some threads, and haven't noticed any other failures, I would expect the root cause to be more specific than that.

One thing I keep an eye on when specific posts or threads cause trouble is the content of those posts, particularly in relation to encoding and special characters. Do your topics randomly remain unread sometimes and others not, or do you have specific topics that never become read no matter how many times you go into them and how many new posts have been made? Do all of them have posts by a specific user with an unusual username? Do all of them use a special MOD that doesn't show up in the threads that update correctly? If you can figure out the pattern, it should be considerably easier to locate and fix the problematic code, configuration or content.

Another check you could make, although I'm not sure it would show anything useful, is compare your cookie before and after you visit a thread that is correctly updated, and before and after you visit a thread that remains unread. You can probably install a browser extension to edit cookies, or just look up where cookies are stored in your folders. When you visit a topic, $board_config['cookie_name'] . '_t' should be updated; in phpbb2refugees' case, that's phpbb2refugees_t. Mine currently decodes to a:1:{i:2100;i:1510675924;}, which is this topic at the time I opened it. I'm guessing that the logic is that this cookie holds a list of topics that have been visited in the current session so that when the forum checks for posts that have been made since your last visit (timestamp in the database), it also ignores those you've read in the current visit (listed in the cookie). It could be interesting to see if your problematic threads don't get added to the cookie at all, or if their timestamp is off the mark as you initially suspected. And if the cookie looks fine, there's something really wrong elsewhere.
Back to top
StarWolf3000
Board Member



Joined: 10 Jun 2010

Posts: 175
Location: Germany


flag
PostPosted: Wed Nov 15, 2017 12:52 pm 
Post subject: Re: How are unread topics tracked?

Without any modification, phpBB2 stores your last visit date and when reading a new post in a topic, it updates some data in your cookie (cookieprefix_t) and the session table. You find the tracking code about in the middle of an unmodified viewtopic.php (look for "// Set a cookie for this topic"). If you want more control over it, install UPI2DB (Unread Post Information 2 DataBase).
Back to top
Vendethiel
Board Member



Joined: 26 Oct 2014

Posts: 251



PostPosted: Wed Nov 15, 2017 12:58 pm 
Post subject: Re: How are unread topics tracked?

I don't think I'd recommend UPI2DB, but Keep unread flags instead. It was started by ptirhiik, which is usually a good thing.
_________________
Developer on EzArena, the ADR premod.
Developer on Icy Phoenix, the phpBB hybrid cms.
Developer on IntegraMOD, the full-featured premod.
Help me archive premods on github! (fixed for recent PHPs).
Back to top
kali
Board Member



Joined: 26 Nov 2013

Posts: 7
Location: Berlin (Germany)


flag
PostPosted: Wed Nov 22, 2017 5:52 pm 
Post subject: Re: How are unread topics tracked?

Thank you all for such detailed info. I didn't get notified of replies on this thread (probably some account setting) so I did lose track of it. I will find some time to have a look into the cookies' content. I did upgrade the server OS which included some minor PHP version upgrade, but that could be related. However as said, that should affect all threads equally and it doesn't.

I am starting to suspect something with the users' account timezone setting, but I really need to look deeply into this issue. I will keep posted with any findings I make.

BTW, I must be one of the few out there running a vanilla, almost unmodified phpbb2 (only some minor customizations on the template and some mod I cannot even remember to prevent automated user registrations). I gotta say I love that obsolescence is the best antidote against spam, since almost no bots or scriptkiddies are anymore interested in spamming me. (Please don't do if you're reading this!)

Cheers
Back to top
MaFt
Board Member



Joined: 09 Jul 2019

Posts: 4



PostPosted: Tue Jul 16, 2019 7:52 am 
Post subject: Re: How are unread topics tracked?

OK, so this is odd. For context our host forced an upgrade to PHP 5.4

Having problems with users saying they're having to log in every time as well as the 'posts since last visit' stuff showing the current date/time as the last visit rather than their actual last visit.

I am starting to suspect cookie issues as when I look in Chrome for [cookie_name] there's nothing showing except for _data and _sid

Is that expected or should there be more cookies than these 2?

MaFt
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Tue Jul 16, 2019 10:24 am 
Post subject: Re: How are unread topics tracked?

Coming here I still see _data, _sid and _t in my cookies.

Perhaps the changes suggested in this thread will help since they were developed around an upgrade to PHP 5.4 as well.
Back to top
Display posts from previous:   
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 4 Hours
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0473 seconds using 16 queries. (SQL 0.0085 Parse 0.0007 Other 0.0382)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo