PDA

View Full Version : vB3 15 Most Recent Searches Made By Our Members


Boofo
02-10-2004, 10:00 PM
vB3 15 Most Recent Searches Made By Our Members
Version 1.1
(By Boofo and EvilLS1)

What does this hack do?
This hack will display the last 15 searches made by your members on your main site search page at the top. The search words are then linked to those search results. It uses your censor options to make sure nothing bad shows up. The searchee will also be visible, but only to Admins. The search box will only show up when searches have been made. The Admin, Supermod and Mod searches will not show up in the listing. It is done this way so any searches made in your private forums are not shown to the regular members.

Credits:
A big thank you goes out to AntiOnline for his original "Last 10 Searches" hack for vB2, partly on which this hack is based.

Version Information:
Version 1.0 --Initial release
Version 1.1 --Re-did the template code to make it match the default style a little better and also added the ability to collaspe the table.

Installation overview:
Files to edit: (1)
--search.php
Templates to edit: (1)
--search_forums

For those wanting the HTL file for this, thanks to Frank, you can get it from this post (https://vborg.vbsupport.ru/showpost.php?p=478666&postcount=21). ;)

The first image is what the other members will see and the second image is what the Admin will see.

Allan
02-11-2004, 08:02 AM
Great Hack, thanks Boofo ;)

Boofo
02-11-2004, 08:11 AM
Thank you, sir. Don't forget the install button. ;)

Experience
02-11-2004, 08:38 AM
Thank you, is great =)

Oblivion Knight
02-11-2004, 08:52 AM
Just a suggestion Boofo :)
Wouldn't it be better placing the two instances of $lastsearch in to templates? lastsearch and lastsearch_staff for example..

Great mod, however the vB2 version was a concern on server load for some (not me personally), how does this compare?

Boofo
02-11-2004, 09:03 AM
I didn't want to clutter up the template with too much code on this. I tried it that way first. Maybe I can re-do a part of it and use conditionals. I'll look at it.

As far as server load goes, I really couldn't say too much about that since my site is so small. It seems to run like it isn't even there on my site, but that might not be the best indicator. All I can say is try it and let me know what the server load looks like. ;)

Allan
02-11-2004, 09:39 AM
Thank you, sir. Don't forget the install button. ;)

no prob, click INSTALL :)

TheComputerGuy
02-11-2004, 10:13 AM
Great Boofo!!

Me says thank you!

Dan
02-11-2004, 10:32 AM
vB3 15 Most Recent Searches Made By Our Members
Version 1.1
(By Boofo and EvilLS1)

What does this hack do?
This hack will display the last 15 searches made by your members on your main site search page at the top. The search words are then linked to those search results. It uses your censor options to make sure nothing bad shows up. The searchee will also be visible, but only to Admins. The search box will only show up when searches have been made. The Admin, Supermod and Mod searches will not show up in the listing. It is done this way so any searches made in your private forums are not shown to the regular members.

Version Information:
Version 1.0 --Initial release
Version 1.1 --Re-did the template code to make it match the default style a little better and also added the ability to collaspe the table.

Credits:
A big thank you goes out to Antionline for his original version of this hack for vB2, partly on which this hack is based.

Installation overview:
Files to edit: (1)
--search.php
Templates to edit: (1)
--search_forums

The first image is what the other members will see and the second image is what the Admin will see.
Interesting hack might use it if i feel the need to install it

FleaBag
02-11-2004, 01:18 PM
Sweet, big fan of this on vB2, glad to see it come to vB3.

gmarik
02-11-2004, 06:11 PM
Could it log IP or user names for admins to show up?

Mike Gaidin
02-11-2004, 08:52 PM
Nice one Bob.

/me clicks install.

Boofo
02-12-2004, 12:12 AM
Sweet, big fan of this on vB2, glad to see it come to vB3.
Thanks! But don't forget that install button (on this hack and the other one). ;)

Boofo
02-12-2004, 12:13 AM
Could it log IP or user names for admins to show up?
I'm not sure what you mean.

lange
02-12-2004, 02:17 AM
Thanks

Lange clicks Install.

AutomatikStudio
02-12-2004, 04:53 PM
Hmmm...I'm a bit confused...I'm not seeing the table with recent searches.

Boofo
02-12-2004, 05:00 PM
It won't show up for Admins and Mods. And the table doesn't show up until any searches are made. Log in as a registered user and make a search and then you will see the table show up. Then log in as Admin again and you will also see the searcher's name in the table. ;)

dbroomjr
02-18-2004, 01:38 PM
me clicks install... and gave the thread a five star rating...Great hack! Keep up the good work.

David

Alien
02-18-2004, 01:49 PM
Very nice, installed and working. :)

* Alien clicks evil install button.

Boofo
02-18-2004, 04:14 PM
Thank you, gentlemen. ;)

Frank
02-21-2004, 11:55 PM
Boofo, here's an HTL file for it (same version as you currently have in text file).

Feel free to include it in your release :)

gmarik
02-22-2004, 07:01 AM
I would want to see who made the search. I'm the admin and want to see the username - if it was out member or the ip - if a guest on our board ...

Frank
02-22-2004, 10:21 AM
I would want to see who made the search. I'm the admin and want to see the username


What does this hack do?
This hack will display the last 15 searches made by your members on your main site search page at the top. The search words are then linked to those search results. It uses your censor options to make sure nothing bad shows up. The searchee will also be visible, but only to Admins. The search box will only show up when searches have been made. The Admin, Supermod and Mod searches will not show up in the listing. It is done this way so any searches made in your private forums are not shown to the regular members.

Boofo
02-22-2004, 04:08 PM
Thank you, Frank. ;)

I'll link to your post with the HTL file from the first post. ;)

FleaBag
02-23-2004, 07:03 AM
Just installed this with the HTL on RC4 - running smoothly. Thanks for this. :)

Boofo
02-23-2004, 07:47 AM
You're getting to be one of my best customers. ;)

Thank you, sir. ;)

TheComputerGuy
03-12-2004, 03:50 PM
I am curious to as this is ignoring some users...I have made it where it shows all users, not some. It shows the like new people, but I know people have been searching a lot more...I just think the hack is not working.

Boofo
03-12-2004, 04:07 PM
The hack is working. It only holds the searches for 24 hours before it deletes them. Keep an eye on it for a few days and you will see that it is working like it is supposed to. ;)

TheComputerGuy
03-12-2004, 04:08 PM
Does it log vistors?

Also...I think I should upgrade to RC4.

Boofo
03-12-2004, 04:12 PM
No, it doesn't log guest searches.

This hack is running on RC3 on my site with no problems.

djohn
03-15-2004, 03:06 PM
Any way to limit the number of recent searches to, for example 5? 15 is way too much for me :)

lokki
03-17-2004, 04:14 AM
This is what I'm trying to reduce the number. If this is in error or incomplete, I'd really appreciate a correction!

in search.php find:

if ($numqueries > 15){
$numqueries = 15;
}

and replace both 15s with whatever you like.

then find:

$lastsearches=$DB_site-> (SNIP) ORDER BY searchid desc LIMIT 0,15");

and change that, too.

Boofo
03-17-2004, 10:10 AM
Any way to limit the number of recent searches to, for example 5? 15 is way too much for me :)

lokki's partly right, but all you really need to change is this part of the query:

LIMIT 0,15

Change ther 15 to whatever you need and that's all you need to change.

You also need to click the install button. ;)

djohn
03-17-2004, 12:41 PM
yep, thanks, you got it
/me clicks install

Boofo
03-17-2004, 12:49 PM
You're very welcome, sir. ;)

milkmycow
03-21-2004, 08:18 PM
does this work with gold?

Alien
03-21-2004, 08:28 PM
Yes.

Boofo
03-21-2004, 10:38 PM
Thanks, Jason. ;)

Alien
03-22-2004, 06:58 AM
No thanks necessary, I love it! :D

Boofo
03-22-2004, 07:18 AM
It's people like you, Jason, that make coding hacks like this a pleasure. I wish more people felt like you do about hacks here. ;) Thank you, again. ;)

Alien
03-23-2004, 04:59 AM
Hey, Thanks alot. =)

/me calls for a group hug.

lol

neocorteqz
03-23-2004, 06:55 AM
Nice Work. :)

I had this installed on vB2.

Used the HTL btw. :) Thanks Frank.

Detomah
03-25-2004, 01:44 AM
Installed, but can't comment as such yet as the forum is closed for major hack work so it's not really functioning as it will yet. :)

It looks good though. ;)

Boofo
03-25-2004, 02:16 AM
Thank you and I'm sure you'll be happy with it. ;)

accyroy
03-25-2004, 06:14 PM
Cheers boofo, great hack! Any way to make it keep things up there for longer than 24 hours? My board doesn't have many searches but I'd still like to keep them there.

Boofo
03-25-2004, 08:14 PM
The hack wouild have to be totally rewritten with a table added to keep the searches longer than what vB allows. The 24 hours is a vB thing. Not much I can do with it as is. Sorry. :(

msimplay
03-29-2004, 07:42 PM
ahem working with fulltext searching 1.9 and vb3 gold
hehe coz am a big fan of it

Boofo
03-29-2004, 08:42 PM
The you need to vote for it in the Hack of the Month for March. ;)

ranger2kxlt
03-30-2004, 04:02 AM
I installed it and got nothing :-(....don't ask what version i have..i haven't a clue it vb3.00 thats all it says and i downloaded it 3/28/03, if that helps?

any suggestions? i did login as a different user, still no go.

Boofo
03-30-2004, 04:09 AM
It is set up to not show Admins, Super Mods or Mod searches. Did you log on under any of those usergroups?

MajorGeek
03-30-2004, 12:32 PM
Installed yesterday (clicked install here) and it originally showed 6 queries. Then 2. Its steady at 2. I used this hack back on Vb2 with less members then there are now and there were always plenty of searches listed. I checked the file from reading this thread and its set tot he default last 15.

Any idea off the top of your head what could be causing this?

I did wipe and rebuild my search index after install hoping that would fix it.

Boofo
03-30-2004, 12:34 PM
The seraches are only held in the db for 24 hours on vB3. I think it was 7 days (if I remember right) on the vB2 version of this hack.

cteselle
03-30-2004, 03:23 PM
<font color="Yellow">* clicks install</font>

Great hack, thanks!

cteselle
03-30-2004, 03:24 PM
It is set up to not show Admins, Super Mods or Mod searches.

Just curious why this is? Security issues?

Boofo
03-30-2004, 03:34 PM
If you (the Admin or Mods) do a search in a private area, it will show up on the list, even though users can't get into that area. By making it so the staff searches don't show up, it avoids any problems the users might have seeing what it is you were looking for in those areas. ;)

Tradjick
04-02-2004, 06:18 AM
Boofo, is there a way to add it to switch this hack on and off?

Boofo
04-02-2004, 06:35 AM
You could probably do it with a profile field. ;)

WreckRman2
04-02-2004, 03:35 PM
The seraches are only held in the db for 24 hours on vB3. I think it was 7 days (if I remember right) on the vB2 version of this hack.


Is there any way to change this? Unless the board is very active odds are no one will every see the latest searches.

Boofo
04-02-2004, 04:19 PM
The only way to change it would be to add another table and 1 or 2 queries to it and I'm not sure that would work as well as it does now. ;)

Nj?rd Eriksson
04-05-2004, 08:57 PM
The hack is working. It only holds the searches for 24 hours before it deletes them. Keep an eye on it for a few days and you will see that it is working like it is supposed to. ;)Great hack but it only seems to hold them for about an hour (or just less than 2 hours) on my board:

7 Most Recent Searches Made By Forum Members
1 post - german-galician - 20 Minutes Ago
16 posts - sergi - 21 Minutes Ago
5 posts - eurafrican - 25 Minutes Ago
9 posts - natufian - 30 Minutes Ago
23 posts - capoid - 35 Minutes Ago
969 posts - russian - 56 Minutes Ago
505 posts - slavs - 1 Hour Ago

It's set to 15 searches. Any idea why that is, and how to fix it?

Nj?rd Eriksson
04-05-2004, 08:59 PM
Are actually Guest searches displayed, too? (I don't believe they are.)

If not is there a way to enable it?

Boofo
04-05-2004, 09:16 PM
No, it's not set up for guest searches now. I did that so the guests wouldn't use the server resources that should be reserved to the members, IMO. It gives them a little more incentive to register that way. ;)

I'm not sure what it would take to add that. I'll have to look into it. ;)

Boofo
04-05-2004, 11:45 PM
Great hack but it only seems to hold them for about an hour (or just less than 2 hours) on my board:

7 Most Recent Searches Made By Forum Members
1 post - german-galician - 20 Minutes Ago
16 posts - sergi - 21 Minutes Ago
5 posts - eurafrican - 25 Minutes Ago
9 posts - natufian - 30 Minutes Ago
23 posts - capoid - 35 Minutes Ago
969 posts - russian - 56 Minutes Ago
505 posts - slavs - 1 Hour Ago

It's set to 15 searches. Any idea why that is, and how to fix it?

It looks to me like you have more guests searching than regular users. As far as how long it is help in the db, it is always 24 hours on my site. Watch it a few days and see if it gets any better. If not, I will have to look uinto it and see why you are having a problem that no one else has had yet.

Nj?rd Eriksson
04-06-2004, 06:11 AM
It looks to me like you have more guests searching than regular users. As far as how long it is help in the db, it is always 24 hours on my site. Watch it a few days and see if it gets any better. If not, I will have to look uinto it and see why you are having a problem that no one else has had yet. Well, I'm watching it for days already, and so far it never displayed older searches than "An Hour ago." - That's the latest one:

3 Most Recent Searches Made By Forum Members
Results- Key Words - Date / Time
50 posts - russian anthropology - 12 Minutes Ago
1 post - russanthro.net - 18 Minutes Ago
150 posts - neanderthal* - 1 Hour Ago
Weird ... not that it would be really a biggy. Would just be nice if it would really keep the last 15 or 20 searches. You have probably more important things to do ...

Boofo
04-06-2004, 07:42 AM
It's not that I have anything more important to do, I just can't figure out why it is doing that to you when no on else has run into this problem yet. This is a new one on me. There's no way my code limits how long a search is kept in the db. Have you installed the full text serach hack by J. Woo, by chance?

Nj?rd Eriksson
04-06-2004, 11:28 AM
It's not that I have anything more important to do, I just can't figure out why it is doing that to you when no on else has run into this problem yet. This is a new one on me. There's no way my code limits how long a search is kept in the db. Have you installed the full text serach hack by J. Woo, by chance?Nopes.

Well, I have no clue either. :)

You said that this controls the number of searches displayed:
... ORDER BY searchid desc LIMIT 0,15");

What's this for?
if ($numqueries > 15){
$numqueries = 15;
}

Might it help if one deleted it, or set it to 100 or something?

Boofo
04-06-2004, 11:45 AM
That first code it part fo the query for the searches. That second code is just for the amount of searches in the titile bar (where it says 7 Most Recent Searches Made By Forum Members ). The 7 is what that second piece of code brings up. ;)

Nj?rd Eriksson
04-06-2004, 12:32 PM
That first code it part fo the query for the searches. That second code is just for the amount of searches in the titile bar (where it says 7 Most Recent Searches Made By Forum Members ). The 7 is what that second piece of code brings up. ;)
Changed both to 100 but didn't help. Still losing my searches after an hour. Strange. :)

Boofo
04-06-2004, 12:53 PM
Do you have the full text search hack installed?

Nj?rd Eriksson
04-07-2004, 06:26 AM
Do you have the full text search hack installed?
Nopes. :|

GamerJunk.net
04-12-2004, 03:55 AM
Cool hack I installed it now!

tantei3
05-03-2004, 12:56 PM
Great hack! Thanks Boofo, I'll install this one.

FleaBag
05-07-2004, 07:15 PM
After upgrading to 3.01 mine doesn't seem to work at all anymore...

BigJohnson
05-07-2004, 07:56 PM
Same here it doesnt show up in the search area at all. Whats up?

Boofo
05-08-2004, 12:00 AM
Same here it doesnt show up in the search area at all. Whats up?

The box won't show up until someone has made at least one search. Make sure you go through the code and re-install the hack after you upgrade.

Intex
05-22-2004, 11:22 AM
Installed and works perfectly on 3.0.1. Good job Boofo :).

* Intex clicks INSTALL

Boofo
05-22-2004, 01:21 PM
Thank you very much and you're very welcome, sir. ;)

WEForums
05-22-2004, 11:24 PM
Yes, sweet hack. Shame almost all the searches are going to be perverted, though...

But I digress. Nice work. Nice to see you didn't feel the same way like the vB2 author did (about not wanting to show the "searchee," even for admins).

Boofo
05-23-2004, 01:08 AM
Yes, sweet hack. Shame almost all the searches are going to be perverted, though...

But I digress. Nice work. Nice to see you didn't feel the same way like the vB2 author did (about not wanting to show the "searchee," even for admins).
How do you mean "almost all the searches are going to be perverted, though..."?

WEForums
05-23-2004, 01:43 AM
haha, weforums has mature content. That's why. lol

Imprezer
06-01-2004, 12:11 AM
Great hack!
Works great!
Thanks!

- Alex

FWF
06-05-2004, 06:34 PM
nice hack

Onkel_Tom
06-05-2004, 11:18 PM
Hi Boofo, my old friend, very nice Hack !
clicked install

thank your ;)

cteselle
07-17-2004, 05:51 AM
vb is also only showing the last hour of searches for me. This was on a fresh 3.0.3 install on my test board. So I did some investigating. I figured I would start at the scheduled tasks, so I took a look at the "Hourly Cleanup" entries. In the file ./includes/cron/cleanup.php I found:

//searches expire after one hour
$DB_site->query("
### Remove stale searches ###
DELETE FROM " . TABLE_PREFIX . "search
WHERE dateline < " . (TIMENOW - 3600)
);
I have not tested this yet, but I don't know why it wouldn't work. You could change the 3600 to whatever you want to get the desired result. 86400 for 1 day, 604800 or 1 week, etc.

If I have problems I will report back.

Boofo
07-17-2004, 08:19 AM
vb is also only showing the last hour of searches for me. This was on a fresh 3.0.3 install on my test board. So I did some investigating. I figured I would start at the scheduled tasks, so I took a look at the "Hourly Cleanup" entries. In the file ./includes/cron/cleanup.php I found:

//searches expire after one hour
$DB_site->query("
### Remove stale searches ###
DELETE FROM " . TABLE_PREFIX . "search
WHERE dateline < " . (TIMENOW - 3600)
);
I have not tested this yet, but I don't know why it wouldn't work. You could change the 3600 to whatever you want to get the desired result. 86400 for 1 day, 604800 or 1 week, etc.

If I have problems I will report back.
Mine have always only showed for 24 hours with vB3. Please keep me posted on what you find out with this. ;)

j_86
07-17-2004, 10:17 AM
I am getting this error;


Database error in vBulletin 3.0.3:

Invalid SQL: SELECT search.searchid,search.orderedids,search.dateline, search.query,search.userid,user.username,user.user id,user.usergroupid FROM vb3_search,vb3_user WHERE query!='' AND user.userid = search.userid AND usergroupid NOT IN (5,6,7) ORDER BY searchid desc LIMIT 0,15
mysql error: Unknown table 'search' in field list

mysql error number: 1109

Date: Saturday 17th of July 2004 12:16:03 PM
Script: http://forum.ugamer.net/search.php?
Referer:
Username: S------
IP Address: -----------


Any ideas why?

My table prefix is vb3_

I'm running 3.0.3 :)

Boofo
07-17-2004, 04:54 PM
JimpsEd (https://vborg.vbsupport.ru/member.php?u=35279),

Change to following queries. They will add the table prefix for you.

Change:

$querycount=$DB_site->query_first("SELECT COUNT(*) AS orderedids FROM " . TABLE_PREFIX . "search LEFT JOIN " . TABLE_PREFIX . "user USING (userid) WHERE query!='' AND usergroupid NOT IN (5,6,7)");

to:

$querycount=$DB_site->query_first("
SELECT COUNT(*) AS orderedids FROM " . TABLE_PREFIX . "search AS search
LEFT JOIN " . TABLE_PREFIX . "user AS user USING (userid)
WHERE query!=''
AND usergroupid NOT IN (5,6,7)
");

Change:

$lastsearches=$DB_site->query("SELECT search.searchid,search.orderedids,search.dateline, search.query,search.userid,user.username,user.user id,user.usergroupid FROM " . TABLE_PREFIX . "search," . TABLE_PREFIX . "user WHERE query!='' AND user.userid = search.userid AND usergroupid NOT IN (5,6,7) ORDER BY searchid desc LIMIT 0,15");

to:

$lastsearches=$DB_site->query("
SELECT search.searchid,search.orderedids,search.dateline, search.query,search.userid,user.username,user.user id,user.usergroupid
FROM " . TABLE_PREFIX . "search AS search," . TABLE_PREFIX . "user AS user
WHERE query!=''
AND user.userid = search.userid
AND usergroupid NOT IN (5,6,7)
ORDER BY searchid desc LIMIT 0,15
");

That should fix it for you. ;)

Make sure to click install. ;)

j_86
07-17-2004, 11:29 PM
Thanks for the tips :)

But, unfortunatly nothing is showing at all - just nothing.

Even from a clean install of your mod with your changes (and yes, template stuff correct);

http://forum.ugamer.net/search.php?

:(

Not even an error message. ( I have also testing searching as regular user, and also turning off User Group *not** 7,6,5

Boofo
07-18-2004, 09:18 AM
Thanks for the tips :)

But, unfortunatly nothing is showing at all - just nothing.

Even from a clean install of your mod with your changes (and yes, template stuff correct);

http://forum.ugamer.net/search.php?

:(

Not even an error message. ( I have also testing searching as regular user, and also turning off User Group *not** 7,6,5
You had to miss something somewhere. Re-check the hack and make sure you didn't miss anything. And also remember, the search listing will not show up until there is at least one successful search made.

j_86
07-18-2004, 10:28 AM
Still definetly not working :surprised:

I cannot understand, i've resinstalled the hack, even installed it on a blank forum install.

Attatched is my Search.php and Template file if you can see anything wrong. The Search Template is a reverted one, with the hack added. The same goes for the search.php file, only with your above query modifications.

I have tried rebuilding search indexes etc.

Boofo
07-18-2004, 12:17 PM
Still definetly not working :surprised:

I cannot understand, i've resinstalled the hack, even installed it on a blank forum install.

Attatched is my Search.php and Template file if you can see anything wrong. The Search Template is a reverted one, with the hack added. The same goes for the search.php file, only with your above query modifications.

I have tried rebuilding search indexes etc.
PM a link to your search.php file and I will take a look at it. We can't post full vb files in posts in here, sorry.

j_86
07-18-2004, 12:21 PM
Attatched, is an extract of the search.php (relevant), too save time.

Boofo
07-18-2004, 12:28 PM
Attatched, is an extract of the search.php (relevant), too save time.
Everything looks normal to me. I don't run 3.0.3 yet so is there anyone who has installed this on 3.0.3. that can maybe help us figure out what is going on? And I will do some checking on this end to see if I can come up with some sort of answer for you. Hang in there, we'll get it working for you. ;)

cteselle
07-18-2004, 06:16 PM
Everything looks normal to me. I don't run 3.0.3 yet so is there anyone who has installed this on 3.0.3. that can maybe help us figure out what is going on? And I will do some checking on this end to see if I can come up with some sort of answer for you. Hang in there, we'll get it working for you. ;)
I have 3.0.3 and it's working for me just fine. I didn't have a chance to look at your template, but your search.php snipit looks just like mine.

Boofo
07-18-2004, 08:58 PM
I have 3.0.3 and it's working for me just fine. I didn't have a chance to look at your template, but your search.php snipit looks just like mine.
Thank you for verifying that. ;)

I think he did the template snippets a few posts up if you want to look at it. ;)

cteselle
07-18-2004, 10:21 PM
Thank you for verifying that. ;)

I think he did the template snippets a few posts up if you want to look at it. ;)
I actually took a look at the search.php snippit, and found 2 things that did not match up to mine. 2 Queries:

Mine:
$querycount=$DB_site->query_first("SELECT COUNT(*) AS orderedids FROM " . TABLE_PREFIX . "search LEFT JOIN " . TABLE_PREFIX . "user USING (userid) WHERE query!='' AND usergroupid NOT IN (5,6,7)");


His:
$querycount=$DB_site->query_first("
SELECT COUNT(*) AS orderedids FROM " . TABLE_PREFIX . "search AS search
LEFT JOIN " . TABLE_PREFIX . "user AS user USING (userid)
WHERE query!=''
AND usergroupid NOT IN (5,6,7)
");

(note the query has been cut up with line breaks)

Then another query:

mine:
$lastsearches=$DB_site->query("SELECT search.searchid,search.orderedids,search.dateline, search.query,search.userid,user.username,user.user id,user.usergroupid FROM " . TABLE_PREFIX . "search," . TABLE_PREFIX . "user WHERE query!='' AND user.userid = search.userid AND usergroupid NOT IN (5,6,7) ORDER BY searchid desc LIMIT 0,15");


his:
$lastsearches=$DB_site->query("
SELECT search.searchid,search.orderedids,search.dateline, search.query,search.userid,use r.username,user.userid,user.usergroupid
FROM " . TABLE_PREFIX . "search AS search," . TABLE_PREFIX . "user AS user
WHERE query!=''
AND user.userid = search.userid
// AND usergroupid NOT IN (5,6,7)
ORDER BY searchid desc LIMIT 0,15
");
(again note the line breaks and commented out line)

So, I would reset those 2 queries to the ones in the install file, just to see if that gets you anywhere. I would have thought they would have worked broken up like that.

I will look at the template in a bit.

edit: our templates are identical.

j_86
07-18-2004, 10:46 PM
Hi there;

I commented out that line, following the install.txt instructions if Iwanted admin searches to show up. Because I use table prefixes in my install, Boofo kindly designed those queries to allow it to auto detect my table prefixes :)

I'll try without line breaks as you said.

Thank you all, for your time.

chapsrulez
07-21-2004, 11:43 PM
I installed this on vb3.0 with no problema

but in another with vb3.0.3 im having some problems.

Database error in vBulletin 3.0.3:

Invalid SQL: SELECT search.searchid,search.orderedids,search.dateline, search.query,search.userid,user.username,user.user id,user.usergroupid FROM forosearch,forouser WHERE query!='' AND user.userid = search.userid AND usergroupid NOT IN (5,6,7) ORDER BY searchid desc LIMIT 0,15

Boofo
07-21-2004, 11:51 PM
I installed this on vb3.0 with no problema

but in another with vb3.0.3 im having some problems.
I don't use these tables in any of the queries. You might want to check the code again. ;)

forosearch
forouser

Seawolf
07-25-2004, 08:36 PM
Nice hack.

chapsrulez
07-26-2004, 05:15 PM
I don't use these tables in any of the queries. You might want to check the code again. ;)

forosearch
forouser

"foro" is my table prefix.

gcurrey
07-31-2004, 02:56 PM
Boofo - Great mod! Do you have some php code that can be run to view ALL searches done which the admin can install/hide somewhere separately from the VB output to keep track of all searches? Maybe this admin version could have a text box so you can specify the amount of entries to display.

qxh
08-12-2004, 11:28 PM
Yeah tables with a prefix have problems with this hack.

cybermomcafe
08-18-2004, 10:38 PM
I can't get it to work... i use vb3_ as my table prefix... any way to make it work?

Thanks!!

Here's the error I get...

Database error in vBulletin 3.0.3:
Database error in vBulletin 3.0.3:

Invalid SQL: SELECT search.searchid,search.orderedids,search.dateline, search.query,search.userid,user.username,user.user id,user.usergroupid FROM vb3_search,vb3_user WHERE query!='' AND user.userid = search.userid AND usergroupid NOT IN (5,6,7) ORDER BY searchid desc LIMIT 0,15
mysql error: Unknown table 'search' in field list

mysql error number: 1109

cybermomcafe
08-18-2004, 11:51 PM
I got it to work...

I changed the SELECT query (line 14 of the part to be added to search.php) from:

$lastsearches=$DB_site->query("SELECT search.searchid,search.orderedids,search.dateline, search.query,search.userid,user.username,user.user id,user.usergroupid FROM " . TABLE_PREFIX . "search," . TABLE_PREFIX . "user WHERE query!='' AND user.userid = search.userid AND usergroupid NOT IN (5,6,7) ORDER BY searchid desc LIMIT 0,15");

to (the table prefix on my board is vb3_)...

$lastsearches=$DB_site->query("SELECT vb3_search.searchid,vb3_search.orderedids,vb3_sear ch.dateline,vb3_search.query,vb3_search.userid,vb3 _user.username,vb3_user.userid,vb3_user.usergroupi d FROM " . TABLE_PREFIX . "search," . TABLE_PREFIX . "user WHERE query!='' AND vb3_user.userid = vb3_search.userid ORDER BY searchid desc LIMIT 0,15");

I removed the usergroups, because I wanted mod/admin searches to show.

I also wrapped the search_forums template edit with this conditional, because I wanted only Admin to see the recent searches.

<if condition="$bbuserinfo[usergroupid] == 6">

</if>

thanks Boofo!

cybermomcafe
08-19-2004, 01:13 AM
One more question... Is there some sort of time limit that the most recent searches are cached for?

When I tested it around 8pm it listed like 4 searches, now it's a bit after 10 and they aren't listed any more?

Thanks!

Boofo
08-20-2004, 05:00 PM
I can't get it to work... i use vb3_ as my table prefix... any way to make it work?

Thanks!!

Here's the error I get...

Database error in vBulletin 3.0.3:
Database error in vBulletin 3.0.3:

Invalid SQL: SELECT search.searchid,search.orderedids,search.dateline, search.query,search.userid,user.username,user.user id,user.usergroupid FROM vb3_search,vb3_user WHERE query!='' AND user.userid = search.userid AND usergroupid NOT IN (5,6,7) ORDER BY searchid desc LIMIT 0,15
mysql error: Unknown table 'search' in field list

mysql error number: 1109
Try this query:

$lastsearches=$DB_site->query("
SELECT search.searchid,search.orderedids,search.dateline, search.query,search.userid,use r.username,user.userid,user.usergroupid
FROM " . TABLE_PREFIX . "search AS search," . TABLE_PREFIX . "user AS user
WHERE query!=''
AND user.userid = search.userid
AND usergroupid NOT IN (5,6,7)
ORDER BY searchid desc LIMIT 0,15
");

weirdpixels
08-23-2004, 12:34 PM
*clicks install
thats now 100 installs well done :)

kenji4861
09-11-2004, 02:14 PM
Works great on VB3.0.3 THANK YOU!

Boofo
09-11-2004, 07:39 PM
Works great on VB3.0.3 THANK YOU!
Don't forget the install button. ;)

intrigue
09-16-2004, 01:13 PM
hmmm dont seem to see it at all on either of me styles i added everything as mentioned in the install
.matt

Blam Forumz
09-20-2004, 06:09 PM
yeah, this didnt work.

i use 3.0.2

joergh
10-02-2004, 11:33 PM
cool hack,

small, easy and useful :)

joergh

FleaBag
10-10-2004, 11:54 PM
I've decided to abandon this, not because it's a bad hack. It seems to work great everywhere but my server lol. Need to cut down on excess code these days. I might look back into trying to get it to work when things calm down!

cteselle
10-14-2004, 02:52 PM
vb is also only showing the last hour of searches for me. This was on a fresh 3.0.3 install on my test board. So I did some investigating. I figured I would start at the scheduled tasks, so I took a look at the "Hourly Cleanup" entries. In the file ./includes/cron/cleanup.php I found:

//searches expire after one hour
$DB_site->query("
### Remove stale searches ###
DELETE FROM " . TABLE_PREFIX . "search
WHERE dateline < " . (TIMENOW - 3600)
);
I have not tested this yet, but I don't know why it wouldn't work. You could change the 3600 to whatever you want to get the desired result. 86400 for 1 day, 604800 or 1 week, etc.

If I have problems I will report back.

Just an update to everyone, the above modification has been working flawlessly for the past few months, so if you are having only the last hours searches showing up, and you would like a week, make the mentioned change. My code is now:

//searches expire after one week
$DB_site->query("
### Remove stale searches ###
DELETE FROM " . TABLE_PREFIX . "search
WHERE dateline < " . (TIMENOW - 604800)
);

hukgwai
11-09-2004, 02:54 PM
Great hack. /me hits install button.

Is there a way to make another usergroup view who searched for what? ie: super moderators to be able to see who searched for what as well as administrators.

Boofo
11-10-2004, 01:03 AM
Great hack. /me hits install button.

Is there a way to make another usergroup view who searched for what? ie: super moderators to be able to see who searched for what as well as administrators.
Yes, but be careful who you allow to see who searched. There are those who will say you are messing with privacy issues. ;)

Look for the following in search.php and add the usergroup in there with an OR statement. ;)

if ($bbuserinfo['usergroupid']=="6") {
$lastsearch="

Rabbitoh Warren
11-16-2004, 02:25 PM
I've installed and tested this okay, but... is it the normal behaviour of this hack to forget the most recent searches after a certain period of time or...?

Boofo
11-16-2004, 02:41 PM
I've installed and tested this okay, but... is it the normal behaviour of this hack to forget the most recent searches after a certain period of time or...?
There is a fix for this here. ;)

https://vborg.vbsupport.ru/showpost.php?p=562140&postcount=116

sabret00the
11-16-2004, 05:28 PM
this don't work with full text on?

Boofo
11-16-2004, 05:36 PM
this don't work with full text on?
I don't have the fulltext serach hack installed so I couldn't tell you but I think there are some using it that do have that hack installed and they have not reported any problems that I know of. ;)

sabret00the
11-16-2004, 06:20 PM
it just hates me then as the $numqueries thing returns a "0" :(

Boofo
11-16-2004, 06:50 PM
it just hates me then as the $numqueries thing returns a "0" :(Since you are an Admin, it will do that for you or any staff. ;)

Because this is in the query for that:

AND usergroupid NOT IN (5,6,7)

alkatraz
11-25-2004, 08:27 PM
installed on vb3.0.3
works great thx!!

sabret00the
11-29-2004, 08:43 PM
Since you are an Admin, it will do that for you or any staff. ;)

Because this is in the query for that:

AND usergroupid NOT IN (5,6,7)
that got removed ;)

Boofo
11-29-2004, 08:45 PM
that got removed ;)
From both queries? ;)

rh2004
12-01-2004, 03:24 PM
Can I hide it from members and only allow admin to view this... ?

jeepinator
12-24-2004, 03:10 AM
This looks cool, but I have a noob question!
What is a "htl" file (and how do I use it)?
Is this something that makes it easier for noobs? :laugh:

Thanks!

Boofo
12-24-2004, 04:09 AM
This looks cool, but I have a noob question!
What is a "htl" file (and how do I use it)?
Is this something that makes it easier for noobs? :laugh:

Thanks!
This is a text file. No htl here. ;)

jeepinator
12-24-2004, 05:52 PM
Boofo, here's an HTL file for it (same version as you currently have in text file)...

This is a text file. No htl here. ;)

A file that exists in fact doesn't?
Thanks for the cryptic answer!
I'll go figure it out. Sorry.

Boofo
12-24-2004, 10:02 PM
A file that exists in fact doesn't?
Thanks for the cryptic answer!
I'll go figure it out. Sorry.
HTL stands for Hack tracking Log. It is a hack for tracking hacks. I don't use it and have no use for it. The htl file was posted by someone else. Maybe ask him next time? ;)

And clicking the install button usually brings better responses, I have found.

jeepinator
12-25-2004, 07:56 AM
Sorry for apparently breaking protocol. I was just asking whomever would be kind enough to answer.
I did install this and it works. Thank you.
And I clicked on the critically important install button as well :cross-eyed:

Boofo
12-25-2004, 04:03 PM
Sorry for apparently breaking protocol. I was just asking whomever would be kind enough to answer.
I did install this and it works. Thank you.
And I clicked on the critically important install button as well :cross-eyed:
The intstall button is a nice way of telling an author that you appreciate all of the work he/she has done and time he/she has put into a hack.

And sorry for my response (or lack thereof) concerning htl. As you can tell, I have no time whatsoever for that hack or htl files in general. I will leave it at that. ;)

Nick0r
01-06-2005, 04:09 PM
Boofo does this work with vb 3.0.3?

http://www.cardschat.com/search.php?

It only shows the table but no information.

MikaK
01-08-2005, 06:27 AM
Installed with a twist... As the table takes a lot of space at the top I simly modded the search results table to appear below the search form instead of above it.

Installed on 303. Had to deal with the usual table_prefix issues, but now working and well:)

=M=

Boofo
01-08-2005, 07:53 AM
Installed with a twist... As the table takes a lot of space at the top I simly modded the search results table to appear below the search form instead of above it.

Installed on 303. Had to deal with the usual table_prefix issues, but now working and well:)

=M=
Can you post a pic so we can see how it looks like that? ;)

MikaK
01-08-2005, 08:04 AM
Can you post a pic so we can see how it looks like that? ;)
You can check it live here:
http://www.soundchilds.net/loud_lounge/search.php?

Graphics are not final ones and the portal is still under heavy modding... practically not publicly open. I don?t mind if someone registers, but they?ll be deleted many times before the actual launch (aimed at the end of February):D

Anyway, feel free to have a look:)
=M=

Boofo
01-08-2005, 08:58 AM
You can check it live here:
http://www.soundchilds.net/loud_lounge/search.php?

Graphics are not final ones and the portal is still under heavy modding... practically not publicly open. I don?t mind if someone registers, but they?ll be deleted many times before the actual launch (aimed at the end of February):D

Anyway, feel free to have a look:)
=M=
I like your background there. ;)

The reason I put it at the top was so you would see it first thing when you went to that page and didn't have to scroll to see it. If it gets used a lot, you might want to reconsider the location. ;)

MikaK
01-08-2005, 10:22 AM
I like your background there. ;)

The reason I put it at the top was so you would see it first thing when you went to that page and didn't have to scroll to see it. If it gets used a lot, you might want to reconsider the location. ;)Tnx:D Meant it to be kinda retro groovy with a positive attitude. Yes, I understand your aim above. Actually, I wouldn?t mind the math data so much, just plain lining up the key words in rows rather than columns would be ideal from my point of view. Would it be difficult to mod?

=M=

MikeeX
01-17-2005, 03:46 PM
I clicked install, I was looking for this :D Thanks for the hack.

James Collins
01-17-2005, 11:32 PM
thanks!

oglsmm
01-18-2005, 01:47 PM
In 3.0.5 it just gives me a database error when I install it. ;;
Plain old vb 3.0.5 with vbadvanced CMPS installed.

Marco van Herwaarden
01-18-2005, 03:09 PM
Well if you want feedback or a solution to your problem, you will have to provide a bit more details on the error you get i guess.

Haiko
02-13-2005, 02:30 AM
Installed, nice hack!

Rabbitoh Warren
04-04-2005, 02:33 PM
Anyone know if this works with v3.0.7? I've attached a screenshot of what I'm seeing after installing this hack...

Doc Great
04-13-2005, 02:04 PM
Great Hack, thanks. But what to change, if I also want to see the guests key words?

Best wishes,
Doc

Edit: and an other problem, the results wont be saved :ermm: i got only one result saved.

yoyoyoyo
04-13-2005, 03:53 PM
Anyone know if this works with v3.0.7? I've attached a screenshot of what I'm seeing after installing this hack...it only shows the searches that have been done since the hack was installed

Doc Great
04-13-2005, 04:16 PM
Yes, that's clear ;) :) but it has been shown two or three results (at about 12 o'clock) now it shows two (the old are lost) .....
Do you know something about my other problem? This was the reason, i installed this hack (i'm interested in the guests key words :D)

Imperial Fritz
05-10-2005, 03:03 PM
/deleted a stupid question

mfarmerhi
05-22-2005, 07:47 AM
Anyone have any direction in making this a vBadvanced module?

I've been plugging away with no luck...

yoyoyoyo
08-18-2005, 10:25 PM
Yes, that's clear ;) :) but it has been shown two or three results (at about 12 o'clock) now it shows two (the old are lost) .....
Do you know something about my other problem? This was the reason, i installed this hack (i'm interested in the guests key words :D)hmm- the same thing happened to me. Boofo- does this sound familiar - is ther a fix?

T3MEDIA
01-07-2006, 09:04 PM
odd I just realized this hack just stopped working. I think it has to do with the forums settings... oh well no one is on 3.0.8 anymore I guess.

CarterMarkham
08-03-2008, 01:04 AM
Can someone help implement this in 3.7.2??

I know a board was using a hack for 3.5 and upgraded to 3.7.2 and it still works, however I dont know where to put this code, and what is the .htl file for?