I used <a href="search.php?action=getlatest&forumid=$forum[forumid]">Read New Posts</a> and that didn't work. It just sent to a page where the search can't be found, even though there were some new posts. Please help.
Originally posted by hellsatan Here are the lines...
PHP Code:
$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 <[url]http://www.php.net/addslashes[/url]>($wheresql)."'")) {
$searchid=$getsearch[searchid];
} else {
// get last search for this user and check floodcheck
Satan
Somehow you get some vbulletin and php.net stuff in it, copy and paste the code wich i posted again.
Originally posted by Carthriller I used <a href="search.php?action=getlatest&forumid=$forum[forumid]">Read New Posts</a> and that didn't work. It just sent to a page where the search can't be found, even though there were some new posts. Please help.
I figured something out. The reason why the first couple of categories worked for this hack is cause there were not any embedded categories in them...while in the other categories, there are sub-categories, how do I go about fixing this(to make it work for subcategories too), thanks.
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>