Sometimes when I click on the last title on the forum home I get the dreaded no thread specified error. I have narrowed it down to this piece of code (which is an addon to this hack posted by PPN elsewhere in this thread).
PHP Code:
// goto newest thread
if ($goto=="newthread") {
if (isset($forumid) and $forumid!=0) {
$foruminfo=verifyid("forum",$forumid,1,1);
$forumid=$foruminfo['forumid'];
$lastthread=$DB_site->query_first("SELECT threadid FROM post WHERE username='".addslashes($foruminfo[lastposter])."' AND dateline='$foruminfo[lastpost]'");
// $lastthread=$DB_site->fetch_array($DB_site->query("SELECT threadid FROM post WHERE username='".addslashes($foruminfo[lastposter])."' AND dateline='$foruminfo[lastpost]'"));
header("Location: showthread.php?s=$session[sessionhash]&threadid=$lastthread[threadid]");
exit;
}
}
and here is the line to replace in the "forumhome_lastpostby" template:
Quote:
<a href="showthread.php?s=$session[sessionhash]&goto=newthread&forumid=$forum[forumid]" title="Go to first post">$forum[lastthread]</a>
|
Can anyone please tell me why the threadid will not update at times? If I go into the Admin CP and use the update counters, then it works fine.