bira
11-25-2001, 10:00 PM
ok, real quicky one: find all threads (note: threads, not posts!) started by X.
Open search.php and find:
// ###################### Start posts by user x #######################
Above it insert:
// ###################### Start threads by user x #######################
if ($action=="userthreads") {
// get allowable forums:
$forumsql=getallforumsql();
// get user:
$usersql=" AND thread.postuserid='$userid'";
$wheresql="1=1".$forumsql.$usersql;
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_searchfloodcheck")."\");");
exit;
}
}
// insert query into db
$DB_site->query("INSERT INTO search (searchid,query,dateline,querystring,showposts,use rid,ipaddress) VALUES (NULL,'".addslashes($wheresql)."',".time().",'".addslashes($query)."',0,$bbuserinfo[userid],'".addslashes($ipaddress)."')");
$searchid=$DB_site->insert_id();
}
eval("standardredirect(\"".gettemplate("redirect_search")."\",\"search.php?s=$session[sessionhash]&action=showresults&searchid=$searchid\");");
}
That's it, essentially. Now you just need to decide where you want to place the link to this.
For example, If you want it to appear in a user's profile, then place the following link in the getinfo template:
<a href="search.php?s=$session[sessionhash]&action=userthreads&userid=$userinfo[userid]">Find threads started by $userinfo[username]</a>
Open search.php and find:
// ###################### Start posts by user x #######################
Above it insert:
// ###################### Start threads by user x #######################
if ($action=="userthreads") {
// get allowable forums:
$forumsql=getallforumsql();
// get user:
$usersql=" AND thread.postuserid='$userid'";
$wheresql="1=1".$forumsql.$usersql;
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_searchfloodcheck")."\");");
exit;
}
}
// insert query into db
$DB_site->query("INSERT INTO search (searchid,query,dateline,querystring,showposts,use rid,ipaddress) VALUES (NULL,'".addslashes($wheresql)."',".time().",'".addslashes($query)."',0,$bbuserinfo[userid],'".addslashes($ipaddress)."')");
$searchid=$DB_site->insert_id();
}
eval("standardredirect(\"".gettemplate("redirect_search")."\",\"search.php?s=$session[sessionhash]&action=showresults&searchid=$searchid\");");
}
That's it, essentially. Now you just need to decide where you want to place the link to this.
For example, If you want it to appear in a user's profile, then place the following link in the getinfo template:
<a href="search.php?s=$session[sessionhash]&action=userthreads&userid=$userinfo[userid]">Find threads started by $userinfo[username]</a>