Here treeleaf.
In each user, when they visit, you record a timestamp. Let's say it's 5 minutes ago.
When a new thread or reply is posted, you record that time into it's own row, like post_time.
When the user comes back five minutes later, it does a search for which threads have a timestamp > then when they were there, and filters those out.
It stores the time the user was there, and compares it against the creation time of rthe message/thread.