PDA

View Full Version : Find threads started by user


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>

squawell
11-26-2001, 05:06 AM
it's great!!:)

can show up in postbit template??

bira
11-26-2001, 05:13 AM
the link for postbit template is

<a href="search.php?s=$session[sessionhash]&action=userthreads&userid=$post[userid]">View all threads started by $userinfo[username]</a>

Cheers,

Bira

bira
11-26-2001, 05:22 AM
Forgot to mention you can view this 'hack' on my bb, at http://www.atlasf1.com/bb (you don't need to be registered in order to view threads or profiles).

I have it added to the user's profile, but also in the first post of a thread (and only there), I have a link "view all threads started by X".

squawell
11-26-2001, 05:34 AM
thankz bira!!

i really think this is a good hack for me~~:D

Lesane
11-26-2001, 06:53 AM
Nice Hack, thanks Bira.

eva2000
12-17-2001, 04:09 PM
late to the party but definitely installing this one :D

bira
12-17-2001, 04:38 PM
here's an add-on to this hack, which I have on my bulletin board:

On my BB (and you can see it at http://www.atlasf1.com/bb/index.php ) on the first post of a thread (and only on that post) there is a link "Find more threads started by this user".

If you want to add that, do the following:

This add-on uses the Post Counter (https://vborg.vbsupport.ru/showthread.php?s=&threadid=22083) hack, so you need to have that installed first (the $post[postcount] version)

1) Create a new template, called postbit_userthreads.

This template should include:


<a href="search.php?s=$session[sessionhash]&action=userthreads&userid=$post[userid]">View all threads started by $post[username]</a>


** Note that the text between the highlighted code above can be whatever you want - text, image/button, whatnot.

2) Open showthread.php and find:


$post[postcount] = ++$postcount;
$postbits .= getpostbit($post);


Change it to (addition marked in high):


$post[postcount] = ++$postcount;
if ($post[postcount]=="1") {
eval("\$post[userthreads] = \"".gettemplate("postbit_userthreads")."\";");
} else {
$post[userthreads] = "";
}
$postbits .= getpostbit($post);


3) edit the template postbit, and place $post[userthreads] at the point where you want this link to show.

C'est tu :)

Lesane
12-17-2001, 04:58 PM
Thanks for the addon Bira, i gonna add it soon.

Parker Clack
12-18-2001, 06:47 PM
Bira:

Great hack yet again. I know I will personally use this a lot. I would really like to see this added to the general search page too.

How is the threadpreview hack working out on your board? I haven't noticed any slow downs at all since installing it.

Parker

Tommy Boy
12-18-2001, 06:57 PM
Neat one, bira! Can the result show preview of the post, like the regular posts search?

bira
12-18-2001, 07:28 PM
Parker - your title preview addon is fan-bloody-tastic. I love it and my users reacted very happily to it (I think it's the latest add-on they most like). No slow-downs or anything on my site. Thanks :)

Tommy - it uses the normal search script. If you search for threads (latest threads or in threadsubject only), you don't get a preview post. And, since this is a search for threads user X started, this post snippet is redundent, really.

Sadie Frost
12-19-2001, 12:07 PM
I love this :)

The other thing that would be better is if it was added to the actual search page functions.

Another great hack bira :)

LanciaStratos
02-20-2002, 07:57 PM
Wow, just what I was looking for, bira! Thanks, great work! :) Now, I just need a hack that will show the last 10 threads a user made in their profile... ;)

wolfe
03-14-2002, 07:46 AM
Cant you make it like the posts on Vbbb.org

where it shows the number and it is a link to search how do i do that in Post bit temp

kippesp
06-19-2002, 05:07 AM
Just getting ready to install it.

Found one bug. If a thread has been moved, it shows up as a poll in the search results. This will fix.

after this $wheresql="1=1".$forumsql.$usersql;add this$wheresql.=" AND thread.open<>10";

inetd
06-19-2002, 07:54 PM
Good hack!
I install this :)

FleaBag
06-20-2002, 03:06 PM
Thanks for this hack, working on 2.2.6! :)

FleaBag
09-04-2002, 07:43 AM
Works with 2.2.7. :)

X-Fan
10-10-2002, 06:53 AM
Just trying to install this on a clean copy of 2.2.8, but I'm not finding this code in showthread.php:

$post[postcount] = ++$postcount;

Help!

:confused:

X-Fan
10-19-2002, 08:15 AM
Anyone?

FleaBag
10-29-2002, 04:42 PM
Working on 2.2.8. :)

X-Fan
11-20-2002, 03:52 AM
How'd you get it working, GF?

julius
01-08-2003, 01:10 PM
The link gives all threads started by all users deleted.

MetroSports82
01-09-2003, 03:58 PM
Works like a charm on 2.2.9. :)

SFishy
05-20-2003, 04:31 PM
Any modifications need to be made to this to work in version 2.3.0 or is it completely compatible?

Anyone?

Salazar
08-08-2003, 06:05 PM
Nice hack!

/me clicks install