Log in

View Full Version : Different way to display posts of a user


Marcus_Fenix
12-01-2008, 07:35 AM
Hi,

I want to tweak a call to search.php, so it does something similar as "search.php?do=finduser&u=[insert_userid]", but it doesn't display a list of posts of that user, but a list of the threads the user has replied in ( Quite similar to the list that you get when using search.php?do=getnew and ordered by the date of the last reply (of any user) in that thread )

Is that even possible with a different call to search.php?
If it's not, is there a plug-in that implements this "my active threads"-feature?

Lynne
12-01-2008, 02:37 PM
If you look at the Advanced Search page you'll see a checkbox for whether you want the results returned as Thread or Posts:
<fieldset class="fieldset">
<legend>Show Results as</legend>
<div style="padding:3px">
<label for="rb_showposts_0"><input type="radio" name="showposts" value="0" id="rb_showposts_0" checked="checked" />Threads</label>
<label for="rb_showposts_1"><input type="radio" name="showposts" value="1" id="rb_showposts_1" />Posts</label>
</div>
</fieldset>

So, it looks like the variable you want is "showposts" and you want to set it to "0"

Marcus_Fenix
12-02-2008, 09:16 AM
Hmm, that is a clue in the right direction :)

How do I incorporate this showposts in an url? So I want something like this, but not exactly this, because this example doesn't work: ;)
/search.php?do=finduser&u=1095&showposts=0

Lynne
12-02-2008, 02:43 PM
It doesn't look like that is a valid parameter for finduser (look around line 3468 in search.php). If you look at the Advanced Search page, you'll see that you can do what you want, you just don't use finduser as the 'do' variable. Take a look at the form and see if you can figure it out. If not, post back and I'll take a look at it.

Marcus_Fenix
12-08-2008, 01:11 PM
Thank you for your help Lynne. You're probably a good teacher, because you pointed me in the right direction, without giving me the answer immediately :)



<form name="MyAT" method="post" action="search.php?do=process">
<input type="hidden" value="process" name="do"/>
<input type="hidden" value="1" name="quicksearch"/>
<input type="hidden" value="1" name="childforums"/>
<input type="hidden" value="1" name="exactname"/>
<input type="hidden" value="" name="s"/>
<input type="hidden" value="0" name="showposts" />
<input type="hidden" value="$bbuserinfo[securitytoken]" name="securitytoken"/>
<input type="hidden" value="$bbuserinfo[username]" name="searchuser" />
<input class="button" type="submit" value="My Active Topics"/>
</form>


Now I just need to change the button into a textlink with javascript :)

Lynne
12-08-2008, 02:36 PM
So you got it to work? All right!

Marcus_Fenix
12-11-2008, 06:47 AM
So you got it to work? All right!

Yup, it works! :) And the users like it.... but it saves (it has some sort of searchcache?) the query and doesn't update real-time. Is there any way to turn this off for this search?

Lynne
12-11-2008, 03:03 PM
Hmmm, I do know that search looks to see if the query has already been performed recently - see the code around line 440. So, if you have 'nocache' set to true, it will not do that. I'm not sure if that is something you can set in your form as a hidden input? It might be worth a try.

Marcus_Fenix
12-15-2008, 07:32 AM
Works! You're my new internethero ;)