waiiiit i think I got it... it seems to work.. should be ready tonight (with only one small cookie, and one db query) Ok, here is a beginning; shows unread threads, but not unread forums, is not that perfect but seems to work:
add this to viewtopic.php, at the beginning:
if ($_COOKIE['unreadtopicscookie'] != '') {
$unreadtopics = array();
$unreadtopics = unserialize(stripslashes($_COOKIE['unreadtopicscookie']));
unset($unreadtopics[array_search($_GET['id'], $unreadtopics)]);
setcookie('unreadtopicscookie', serialize($unreadtopics), time()+60*60*24*335); /* One year cookie*/
}
and add this to viewforum.php (below the two includes):
if ($_COOKIE['unreadtopicscookie'] != '') {
$unreadtopics = array();
$unreadtopics = unserialize(stripslashes($_COOKIE['unreadtopicscookie']));
$result = $db->query('SELECT id , last_post FROM '.$db->prefix.'topics') or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
while ($row = $db->fetch_row($result))
if ($row[1]>$cur_user['last_visit'] && !in_array($row[0], $unreadtopics))
array_push($unreadtopics, $row[0]);
setcookie('unreadtopicscookie', serialize($unreadtopics), time()+60*60*24*335); /* One year cookie*/
} else {
$unreadtopics = array();
}
And finally in viewforum.php, where the test if the topic is read or not (should be approximatively at line 165), replace the condition with:
if (!$cookie['is_guest'] && in_array($cur_topic['id'], $unreadtopics) && $cur_topic['moved_to'] == null)
I'll try to cleanup all that stuff, and make it work in the listing of the forums, too... help would be much appreciated.
++
I forgot, turn Visit timeout to 0 in the admin panel.
BTW, in misc.php, add :
setcookie('unreadtopicscookie', '', time()+60*60*24*335);
in the else if ($action == 'markread') statement.