PDA

View Full Version : Search for Posts in Thread by Username


Andreas
07-03-2005, 10:00 PM
<font size="3">Search for Posts in Thread by Username</font>

Description
Do you know that? You are searching for that one Post in a single Thread made by a specific User, but you can't remember the Text.
Unfortunately the Thread is several hundred Posts long - and the User has tons of Posts in the Forum that Thread belongs to.
So searching for Keywords in the Thread doesn't work, and searching for the Posts made by the User also doesn't help much.
This Hack solves the Problem by allowing you to search for Posts from a specific User made in a specific Thread.

Details
1 Plugin XML
1 Template Edit

History
1.0.0
Initial Version

1.0.1
vBulletin 3.5.2 compatibility

Please only click Install if you actually have installed/are using this Hack, and click Uninstall whan you don't use it any longer!

Chris M
07-04-2005, 09:57 PM
Excellent :)

Should be in vB by default :)

Satan

Chris M
07-04-2005, 10:00 PM
I think your instructions are a bit flawed Kirby:p

2) In Template FORUMHOME
FIND
----------------------------------------------------------------------
<input type="text" class="bginput" name="query" size="20" />$gobutton<br />
----------------------------------------------------------------------
I think you mean SHOWTHREAD ;)

Not had much sleep?:p

Satan

Andreas
07-04-2005, 10:03 PM
Aargh ... too tired ;)
Of course it is SHOWTHREAD.

Gonna re-upload the File now (I'love the creation process - just one click to rebuild the ZIP :D)

Chris M
07-04-2005, 10:04 PM
Aargh ... too tired ;)
Of course it is SHOWTHREAD.

Gonna re-upload the File now (I'love the creation process - just one click to rebuild the ZIP :D)
:) Go inject some coffee into your eyes ;)

That'll wake you up, and also cause you to lose your sight for several hours :p

Satan

KTBleeding
07-04-2005, 11:24 PM
Wow.. I've wanted this for vB for so long. Guess this gives me a reason to upgrade.

Allan
07-05-2005, 04:28 AM
very nice KirbyDE :)

artonex
09-12-2005, 11:08 AM
Very nice im going to install it now :)

Mathiau
09-14-2005, 10:01 PM
i love you - i had made a request for something like this back in 2.* days. hope it works on RC3..

Andreas
09-14-2005, 10:08 PM
Should work just fine in RC3

buro9
09-15-2005, 06:21 AM
This is good... and so close to what I had hacked into 3.0.x

What I'm looking for is a search function that can be given a threadid and userid, not username. And that can be called from a GET query, such as search.php?threadid=123&userid=123 and then show the results as posts.

Where I put this is on the popup showing number of people who posted in a thread. I made the numbers clickable so that the opener window changed to show which posts they were.

That should be in vBulletin by default and is not.

But my question is... how could I adjust the hack to use userid, and what should be the URL I would need to see the results?

EasyTarget
09-15-2005, 02:14 PM
How could I edit this so that the boxes are separated by a title? One box that says Username and one that says Keyword.

Like the hack that lets you search posts and titles.

Andreas
09-15-2005, 02:17 PM
Just modify the Template as you like :)

EasyTarget
09-16-2005, 08:48 AM
<div class="vbmenu_popup" id="threadsearch_menu" style="display:none">
<form action="search.php" method="post">
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<td class="thead">$vbphrase[search_this_thread]<a name="goto_threadsearch"></a></td>
</tr>
<tr>
<td class="vbmenu_option" title="nohilite">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="do" value="process" />
<input type="hidden" name="searchthread" value="1" />
<input type="hidden" name="showposts" value="1" />
<input type="hidden" name="searchthreadid" value="$threadid" />
<if condition="$show['searchthreaduser']">
<div class="vbmenu_option">$vbphrase[username]:</div>
<input type="text" class="bginput" name="searchuser" size="20" /><br />
</if>
Keyword:<br>
<input type="text" class="bginput" name="query" size="20" />$gobutton<br />
</td>
</tr>
<tr>
<td class="vbmenu_option"><a href="search.php$session[sessionurl_q]">$vbphrase[advanced_search]</a></td>
</tr>
</table>
</form>
</div>is there anything I should add or fix from this code so that its more correct? I changed the div class to vbmenu_option and I added the word 'keyword:'. Is there some other/better way to do this?

The Wise One
10-10-2005, 03:08 PM
installed. thanks.

buro9
10-10-2005, 03:25 PM
Is there a way to call this with a URL like:
search.php?threadid=XXX&userid=YYY

And have it show everything that someone has posted in a thread?

cnutter
10-10-2005, 05:25 PM
I tried to install this but It didnt seem to work so what did I miss?

I made teh proper edit in the templet and installed the plugin any ideas?

Andreas
10-10-2005, 05:28 PM
@buro9
Yes, it's possible.
do=process&searchthreadid=X&userid=Y

@cnutter
What exactly does not work?

cnutter
10-10-2005, 05:33 PM
@cnutter
What exactly does not work?


KirbyDE,

Maybe, I am not getting it but when I went to a forum to do a search in a very large thread on my site to test it I couldnt find/see the search field as show in your screen shot of the hack.

I maybe missing something.... :ermm:

cnutter
10-10-2005, 05:46 PM
KirbyDE

I figured it out....

<input type="text" class="bginput" name="query" size="20" />$gobutton<br /> There are two instances of this exact line in the SHOWTHREAD templet.

I had put it above the wrong one.

Its fixxed now.... thanx....

Andreas
10-10-2005, 05:56 PM
Whoops :)
Gonna have to update the instructions then.
Thanks for pointing that out.

buro9
10-10-2005, 09:52 PM
@buro9
Yes, it's possible.
do=process&searchthreadid=X&userid=Y

Fantastic... installed.

But... there's a bug.

If I search a thread for a user:
search.php?do=process&amp;searchthreadid=133&amp;userid=26 7

And then perform a search for another user against the same thread:

search.php?do=process&amp;searchthreadid=133&amp;userid=38 9

The first results always comes back.

It's as if vBulletin caches the search result according to the threadid and pays no attention to the userid.

If you want to view this on mine, just click the Who Posted link and you'll see that I've made the Who Posted popup link back via the postcount to the search result. Except... it has that bug.

Andreas
10-10-2005, 10:03 PM
Yes, vBulletin does cache the results without taking the Username into account - and there is no way to get around this limitation without editing search.php.
(Except "disabling" caching results for this search, which I did on my site).

buro9
10-11-2005, 04:13 AM
Yes, vBulletin does cache the results without taking the Username into account - and there is no way to get around this limitation without editing search.php.
(Except "disabling" caching results for this search, which I did on my site).

I can totally do that :) How though?

I already have search result sharing disabled in my AdminCp > vBulletin Options > Message Searching Options.

Is there another way around this... did you comment out some code to achieve this?

(btw... disabling the search cache would fix a bug in vBulletin where it's possible to get someone elses search results and have the results ordered incorrectly).

So totally up for this, how though :)

buro9
10-11-2005, 09:48 PM
I can totally do that :) How though?

Done it... commented out a chunk of search.php :)

Andreas
10-11-2005, 09:54 PM
I used a somewhat dirty trick to avoid file edits :)

search_process_start

if ($searchuser AND $vbulletin->GPC['searchthreadid'] AND !$vbulletin->GPC['query'])
{
$realuserid = $vbulletin->userinfo['userid'];
$vbulletin->userinfo['userid'] = -1;
}



search_process_fullsearch

$vbulletin->userinfo['userid'] = $realuserid;


This way vBulletin does not find a valid searchhash and performs a new search.

buro9
10-11-2005, 09:59 PM
I used a somewhat dirty trick to avoid file edits :)

search_process_start

if ($searchuser AND $vbulletin->GPC['searchthreadid'] AND !$vbulletin->GPC['query'])
{
$realuserid = $vbulletin->userinfo['userid'];
$vbulletin->userinfo['userid'] = -1;
}



search_process_fullsearch

$vbulletin->userinfo['userid'] = $realuserid;


This way vBulletin does not find a valid searchhash and performs a new search.

Brilliant and very amusing.

I think I'll stick with file edits though, I'm comfortable with them and can upgrade even my heavily modded board in less than 30 minutes with all hacks migrated... a short enough time for me to care about, and at least I have no plugin overhead.

Hey... have you published your private hack to prevent pulling in plugins all the time? You have one don't you? (imagines it writes .php files out during plugin installs and just puts include statements into the hooks)

Andreas
10-11-2005, 10:03 PM
I've got a neat Windows proggy to slipstream plugins into vBulletin, yes. :)
But I havn't updated it to process product XMLs ... yet.

My board is so hacked that even with Tools like Beyond Compare, the last upgrade (3.0.0 RC2 -> 3.0.6) took some hours to get it working again without errors, although the new Version had been tested before by the whole team for some days.
Not to mention the Style stuff which took weeks.

Neal-UK
10-11-2005, 10:07 PM
I've got a neat Windows proggy to slipstream plugins into vBulletin, yes. :)
But I havn't updated it to process product XMLs ... yet.

My board is so hacked that even with Tools like Beyond Compare, the last upgrade (3.0.0 RC2 -> 3.0.6) took some hours to get it working agin without errors, although the new Version had been tested before by the whole team for some days.
Not to mention the Style stuff which took weeks.

excellent mod, nice one again

buro9
10-12-2005, 04:28 AM
My board is so hacked that even with Tools like Beyond Compare, the last upgrade (3.0.0 RC2 -> 3.0.6) took some hours to get it working again without errors, although the new Version had been tested before by the whole team for some days.

Not to mention the Style stuff which took weeks.

Yeah, that's where mine is. I eventually invested in Slick Edit and keep a very tightly controlled set of conventions over marking up hacks within the code, the changes made, etc. Done well file changes are easy to migrate and not too time consuming.

Style changes take time though, that I'll admit, but that would be the case even with the plugin system. Especially because most of the time I cut 'n' paste the templates into Slick Edit so that I can use a powerful diff and merge tool to make the new version.

I dread to think how difficult it will be to upgrade when I finish the XHTML Strict style I've been hacking together for weeks (reduced tables, highly semantic).

Andreas
12-08-2005, 01:39 PM
A variable name has changed.

Andreas
12-08-2005, 02:13 PM
Why not just import the new XML?

Lea Verou
12-09-2005, 07:39 AM
I know you're a busy man (very), but will you be fixing this one for us, it's something my users like a lot?

:)

Great!! I will install in a few days :)

Suggestion: The 2 editboxes look kinda messy. It would be better to have 2 radio buttons underneath one editbox like:
(o) Text ( ) Username
What do you think?

Andreas
12-09-2005, 07:41 AM
Then you would not be able to search for posts by foo containing bar, which is possible with the current implementation ;)

Lea Verou
12-09-2005, 07:43 AM
I think it doesn't matter if you lose some of the functionality to make it look neater. :)
Of course some people might prefer it this way so I think if it's not hard you could make a second version of the hack for people who prefer it that way :)
What do you think? :)

Andreas
12-09-2005, 07:45 AM
That hasn't worked. The new zip contains plugins, not a product, and I coulnd't get them to work either as a replacement, or alongside, the 1.0.0 version?
LOL, I zipped the wrong file ^.^
Should be the correct one now.

What do you think? :)
I think I prefer it this way and see no need for a crippled version :)

Lea Verou
12-09-2005, 07:49 AM
I think I prefer it this way and see no need for a crippled version :)

Ok... :( :( You made me sad :( :( :( :p

Lea Verou
12-09-2005, 07:53 AM
Thanks. ;) Works again now.

As for the "neatness", I just changed the template a bit so it's more broken up, and says

Username:
[INPUT BOX]
And/Or Keywords:
[INPUT BOX]

I think that looks OK myself. Each to their own.

Hmm yeah, that sounds a little better :)

Andreas
12-09-2005, 07:56 AM
Username:
[INPUT BOX]
And/Or Keywords:
[INPUT BOX]

That's almost as I got it (except the And/Or). Isn't that how the template edit instructions are?

FleaBag
12-12-2005, 11:07 AM
Just installed... Many thanks. Your thread still says vB 3.5.0 - just so you know. ;)

EvilHawk
01-07-2006, 02:40 PM
It appears to have stopped working on 3.5.3!
It was a very usefull add on for our users!
Could you please update this product?

TIA

EasyTarget
01-08-2006, 07:25 AM
yeah, I just uninstalled and reinstalled to test it and it looks like the search thread for posts by user ends up finding all the posts by the user, in other threads too.

Andreas
01-10-2006, 12:04 AM
Seems to work fine for me on 3.5.3

EvilHawk
01-10-2006, 09:46 AM
Uninstall and reinstall solved the problem!

Thank you sir!

fridayweb
10-22-2006, 03:56 PM
Couldn't get this to work in 3.6. :(

I see you can do it through advanced search, but I didn't know if this was hack was going to be updated or not.

Tralala
02-14-2007, 07:22 PM
Works for me with 3.6.4.

RedGTiVR6
04-27-2007, 03:26 PM
That's the only difference, just broke it up a little and I felt made it a little clearer for the average user. But yours I thought was fine too.

:)

Create a phrase as follows:

Product: Search for Post in thread by User name
Varname: and_or_keywords (or whatever you please)
Text: And/Or Keywords
Phrase Type: GLOBAL

In template SHOWTHREAD find:

<input type="text" class="bginput" name="query" size="20" />$gobutton<br />


Add below:

<if condition="$show['searchthreaduser']">
<div class="smallfont">$vbphrase[username]:</div>
<input type="text" class="bginput" name="searchuser" size="20" />$gobutton<br />
</if>
<div class="smallfont">$vbphrase[and_or_keywords]:</div>
<input type="text" class="bginput" name="query" size="20" />$gobutton<br />

With the phrase and template edit as above, it will look like the attached image. You can omit the 'Go' button as necessary and change the and/or keywords as you see necessary to fit your board.

btw - appears to work fine on 3.6.5

RedGTiVR6
04-27-2007, 03:39 PM
That's almost as I got it (except the And/Or). Isn't that how the template edit instructions are?

No - the template instructions make it so that there is nothing telling users what the seond box is for now. While those who are very familiar with vBulletin would know, those who aren't might now understand.

btw- mod installed! Very nice feature!

goxy63
04-20-2011, 11:37 PM
I am sorry to bring up this mod/thread again
But is there such thing for vb4, something like we have here at vb.org???(search this mod/find my posts)

I know that from advanced serach we have this option, but by my humble experience not even 5% users would use that