PDA

View Full Version : Help - Linking to Search in Only SOME Boards


H3C x Nevz
04-25-2009, 05:32 PM
I've edited a template and included this search to find all threads started by a user.
<a href="search.php?$session[sessionurl]do=finduser&u=$post[userid]&starteronly=1">Threads Started</a>

How would I make it search in only specified boards? For instance, forumIDs 26 and 28.

Lynne
04-25-2009, 06:38 PM
Take a look on the Forums page and see the links that say "Click here to view the latest topics" and you should get a good idea of how to do that. Or, look at the search.php code and you'll see the variables allowed also.

If you still need help, post back here with the different code you have tried and we'll see if we can help figure out what is wrong.

H3C x Nevz
04-25-2009, 10:21 PM
I am not extremely experienced in PHP, and I really can't seem to find the correct variable or how to format it correctly... sorry...

Lynne
04-25-2009, 10:55 PM
I am not extremely experienced in PHP, and I really can't seem to find the correct variable or how to format it correctly... sorry...
You are interested in do=finduser, so open search.php and you'll find this line about that:
if ($_REQUEST['do'] == 'finduser')Under that is the section that deals with that do variable. Right under there is this:
$vbulletin->input->clean_array_gpc('r', array(
'userid' => TYPE_UINT,
'starteronly' => TYPE_BOOL,
'forumchoice' => TYPE_ARRAY,
'childforums' => TYPE_BOOL,
'searchthreadid' => TYPE_UINT,
));That defines the variables it will be looking for. Of that list, I'd say forumchoice would be the one you are looking for. So, try that and see if it works.

H3C x Nevz
04-26-2009, 03:44 PM
I appreciate your help, but I have no idea how to take that and make a properly formatted link out of that.

Lynne
04-27-2009, 02:42 AM
You need to add the variable to the end of your link.

You wrote this:
<a href="search.php?$session[sessionurl]do=finduser&u=$post[userid]&starteronly=1">Threads Started</a>
Add it at the end like this:
<a href="search.php?$session[sessionurl]do=finduser&amp;u=$post[userid]&amp;starteronly=1&amp;forumchoice[]=xxx,yyy">Threads Started</a>

(Not tested - you may have to play with it.)

H3C x Nevz
04-27-2009, 11:42 PM
Thanks so much for your help - you have been a lifesaver, Lynne. I just have one more question: I currently have this link (Which works perfectly) and the text currently displays "Posted Content." How could I make it "[USERNAME OF USER]'s Posted Content"?

Lynne
04-28-2009, 01:51 AM
Um, I'm not sure where on your site it says that, but you are talking about the actual viewer of the page, right? Doesn't it usually say the name in the search field? You can try using either $user[username] or $searchuser[username] and see if that works.

H3C x Nevz
04-28-2009, 08:16 PM
I'm displaying this below someone's signature with the aid of a mod. I'd like it to display that user's name below their sig.

Lynne
04-28-2009, 08:26 PM
You want to display the name of the poster in the same poster's signature? I think $post[username] is the username of the poster.

H3C x Nevz
04-28-2009, 08:40 PM
Okay, thank you so much. I'm all set - this can be locked.