I'm thinking that the problem is in tree_msg.php.t and root_index.php.t
Back on 17/04/2011 a change was made to tree_msg.php.t, the following was removed:
th_inc_view_count($msg_obj->thread_id);
if (_uid && $msg_obj) {
if ($msg_obj->last_forum_view < $msg_obj->post_stamp) {
user_register_forum_view($msg_obj->forum_id);
}
if ($msg_obj->last_view < $msg_obj->post_stamp) {
user_register_thread_view($msg_obj->thread_id, $msg_obj->post_stamp, $msg_obj->id);
}
}
at the same time a switch statement was added to root_index.php.t:
switch ($t) {
case 'msg':
if (!isset($_GET['prevloaded'])) {
th_inc_view_count($frm->id);
}
if (_uid && $obj2) {
if ($frm->last_forum_view < $obj2->post_stamp) {
user_register_forum_view($frm->forum_id);
}
if ($frm->last_view < $obj2->post_stamp) {
user_register_thread_view($frm->id, $obj2->post_stamp, $obj2->id);
}
}
break;
case 'tree':
th_inc_view_count($msg_obj->thread_id);
if (_uid && $msg_obj) {
if ($msg_obj->last_forum_view < $msg_obj->post_stamp) {
user_register_forum_view($msg_obj->forum_id);
}
if ($msg_obj->last_view < $msg_obj->post_stamp) {
user_register_thread_view($msg_obj->thread_id, $msg_obj->post_stamp, $msg_obj->id);
}
}
break;
case 'login':
/* Clear expired sessions AND anonymous sessions older than 1 day. */
q('DELETE FROM {SQL_TABLE_PREFIX}ses WHERE time_sec<'. (__request_timestamp__- ($FUD_OPT_3 & 1 ? $SESSION_TIMEOUT : $COOKIE_TIMEOUT)) .' OR (user_id>2000000000 AND time_sec<'. (__request_timestamp__- 86400) .')');
break;
case 'thread':
case 'threadt':
if (_uid) {
user_register_forum_view($frm_id);
}
break;
}
I've changed the switch statement to add an item for 'tree_msg' that falls through to 'tree'. That means that it then gets called when navigating the thread tree via AJAX.
I'm not sure whether this fix is 100% correct yet, it is possible that it is marking stuff read that it shouldn't be.