Either method would be OK for a smaller forum. However the method you suggest would be an absolute server-killer for a decent sized forum because of the amount of data involved in marking each thread read, as has been discussed here elsewhere before.
Anyway this sounded interesting so I whipped up something for my forums. Code changes are below - it's actually quite simple.
In forumdisplay.php find
PHP Code:
$threadids='thread.threadid IN (0'.$stickyids;
Replace it with
PHP Code:
$threadids='threadid IN (0'.$stickyids;
Find
PHP Code:
// check to see if there are any threads to display. If there are, do so, otherwise, show message
Right below it add
PHP Code:
$posts = $DB_site->query("SELECT COUNT(*) AS posts,threadid FROM post WHERE $threadids AND dateline>$bbuserinfo[lastvisit] GROUP BY threadid");
while ($post = $DB_site->fetch_array($posts)) {
$newpost[$post[threadid]] = $post[posts];
}
Find
PHP Code:
if (($bbuserinfo[maxposts] != -1) and ($bbuserinfo[maxposts] != 0))
Right above it add
PHP Code:
if ($newpost[$thread[threadid]]) {
$newposts = $newpost[$thread[threadid]];
eval("\$numnew = \"".gettemplate('forumdisplaybit_newposts')."\";");
} else {
$newposts = " ";
eval("\$numnew = \"".gettemplate('forumdisplaybit_newposts')."\";");
}
And then you need to add a template named
forumdisplaybit_newposts with the following contents:
Code:
($newposts new post(s))
And then edit the forumdisplay_threadslist template...
Find
Code:
<td bgcolor="{tableheadbgcolor}" nowrap><smallfont><a href="$sorturl&sortorder=desc&sortfield=replycount"><font color="{tableheadtextcolor}"><b>Replies</b></font></a> $sortarrow[replycount]</smallfont></td>
Right below it add
Code:
<td bgcolor="{tableheadbgcolor}" nowrap><smallfont><font color="{tableheadtextcolor}"><b>New Posts</b></font></smallfont></td>
Then find
Code:
<td bgcolor="{tableheadbgcolor}" width="100%" colspan="8" align="center"><smallfont color="{tableheadtextcolor}">
and change the "8" to "9".
Then in the forumdisplaybit template find
Code:
<td bgcolor="$fbackcolor"><normalfont>$thread[views]</normalfont></td>
and right *above* it add
Code:
<td bgcolor="$fbackcolor"><normalfont>$numnew</normalfont></td>
And that's it.