How would you do this for the New Posts icon at the left of the forum description where it would only link to the icon if there were new posts in that thread (like they do here on vb.org)?
Quote:
Originally posted by Lesane Open root/search.php and find:
// ###################### Start get latest #######################
if ($action=="getlatest") {
// generate query
// do it!
if ($bbuserinfo[userid]!=0 or $bbuserinfo[lastvisit]!=0) {
$forumsql=" AND forumid=$forumid";
// get date:
$datesql=" AND thread.lastpost>=".$bbuserinfo[lastvisit];
$wheresql="1=1".$forumsql.$datesql;
$wheresql.=" AND thread.open<>10";
if ($getsearch=$DB_site->query_first("SELECT searchid FROM search WHERE query='".addslashes($wheresql)."'")) {
$searchid=$getsearch[searchid];
} else {
// get last search for this user and check floodcheck
if ($prevsearch=$DB_site->query_first("SELECT searchid,dateline FROM search WHERE ".iif($bbuserinfo[userid]==0,"ipaddress='$ipaddress'","userid=$bbuserinfo[userid]")." ORDER BY dateline DESC LIMIT 1")) {
if (time()-$prevsearch[dateline]<$searchfloodcheck and $searchfloodcheck!=0) { // and !ismoderator()) {
eval("standarderror(\"".gettemplate("error_pmfloodcheck")."\");");
exit;
}
}
// insert query into db
$DB_site->query("INSERT INTO search (searchid,query,dateline,querystring,showposts,userid,ipaddress) VALUES (NULL,'".addslashes($wheresql)."',".time().",'".addslashes($query)."',0,$bbuserinfo[userid],'".addslashes($ipaddress)."')");
$searchid=$DB_site->insert_id();
}
Now u can use this link to get the results of a specific forum:
PHP Code:
search.php?action=getlatest&forumid=XX
Where xx is the forumid.
As you can see on my forum i putted it in the template: "Forum Home Page Templates -> forumhome_forumbit_level1_post & forumhome_forumbit_level2_post with the following code:
PHP Code:
<a href="search.php?action=getlatest&&forumid=$forum[forumid]">Read New Posts</a>