Saturday, August 18, 2007

LeetBoard Tech: "Is Read?" Issue

A feature that is familiar to everyone who uses any sort of forum software is the "Is Read?" or "Is New" feature. This feature is responsible for telling you what posts you have and havent read every time you log into or visit a board. Every forum software has a different way of accomplishing this. LeetBoard uses its own unique style, utilizing a database and cookies.

When you first log into LeetBoard, a blank cookie is set. When you read a topic, the ID of the topic and its newest reply is saved to the cookie. If a topic was made between your previous login time (your last login) and the time you just now logged in, and that topic does not appear in the cookie, the topic is marked as new. Similarly, if a new reply was made between your previous login and your recent login, and the parent topic's ID and the reply's ID dont appear together in the cookie, the topic is marked as new. Logically, this should be a perfect method for checking if a post is read or not, but for some reason it does not work correctly. I am not sure why this is, but I am currently working to figure out what the problem is and fix it.

Edit: The problem was due to a conflict with how posts were decided as being read or unread. Each member has a "last login" time saved with their account. This time is saved each time the user logs in, and its previous value is used to see if posts were made between the previous last login and the current time. The issue has been resolved by adding a query that updates the last login time to the current time when the user logs out. Issues may still occur if the user explicitly deletes the cookie which stores the forum session or lets the session expire without logging out.

No comments: