vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   vB3 15 Most Recent Searches Made By Our Members (https://vborg.vbsupport.ru/showthread.php?t=61424)

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:

PHP Code:

//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

Quote:

Originally Posted by cteselle
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:

PHP Code:

//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;

Code:

Database error in vBulletin 3.0.3:

Invalid SQL: SELECT search.searchid,search.orderedids,search.dateline,search.query,search.userid,user.username,user.userid,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,

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

Change:

PHP Code:

$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:

PHP Code:

$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:

PHP Code:

$lastsearches=$DB_site->query("SELECT search.searchid,search.orderedids,search.dateline,search.query,search.userid,user.username,user.userid,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:

PHP Code:

 $lastsearches=$DB_site->query("
SELECT search.searchid,search.orderedids,search.dateline,search.query,search.userid,user.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
"
); 

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

Quote:

Originally Posted by JimpsEd
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

Quote:

Originally Posted by JimpsEd
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

Quote:

Originally Posted by JimpsEd
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

Quote:

Originally Posted by Boofo
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

Quote:

Originally Posted by cteselle
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

Quote:

Originally Posted by Boofo
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:
PHP Code:

 $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:
PHP Code:

 $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:
PHP Code:

 $lastsearches=$DB_site->query("SELECT search.searchid,search.orderedids,search.dateline,search.query,search.userid,user.username,user.userid,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:
PHP Code:

 $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.

Quote:

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

Quote:

Originally Posted by chapsrulez
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

Quote:

Originally Posted by Boofo
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:
Code:

Database error in vBulletin 3.0.3:

Invalid SQL: SELECT search.searchid,search.orderedids,search.dateline,search.query,search.userid,user.username,user.userid,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:

Code:

$lastsearches=$DB_site->query("SELECT search.searchid,search.orderedids,search.dateline,search.query,search.userid,user.username,user.userid,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_)...

Code:

$lastsearches=$DB_site->query("SELECT vb3_search.searchid,vb3_search.orderedids,vb3_search.dateline,vb3_search.query,vb3_search.userid,vb3_user.username,vb3_user.userid,vb3_user.usergroupid 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.

Code:

<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

Quote:

Originally Posted by cybermomcafe
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:
Code:

Database error in vBulletin 3.0.3:
 
Invalid SQL: SELECT search.searchid,search.orderedids,search.dateline,search.query,search.userid,user.username,user.userid,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:

PHP Code:

$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

Quote:

Originally Posted by kenji4861
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

Quote:

Originally Posted by cteselle
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:

PHP Code:

//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:

PHP Code:

//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

Quote:

Originally Posted by hukgwai
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. ;)

PHP Code:

  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

Quote:

Originally Posted by Rabbitoh Warren
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....&postcount=116

sabret00the 11-16-2004 05:28 PM

this don't work with full text on?


All times are GMT. The time now is 09:44 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01617 seconds
  • Memory Usage 1,875KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (14)bbcode_php_printable
  • (15)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete