PDA

View Full Version : Add a Separate Page to your Forum to search Last XX Days


indiamike
04-26-2002, 10:00 PM
This is a simple hack.
What is does is adds a new page to your forum to allow the user to view posts by the last xx number of days. What's different in this hack is that we don't replace the "get daily function" (which has been the big hurdle with this type of hack).

This only adds a new php page that can be linked to from anywhere in the forum to search by the last xx days.

Very simple to do and install time is about 10 minutes and should work with all later versions of vb.

Here is a working online example -Day Search (http://www.indiamike.com/india/search.php) .

In my version it just creates a text link to the day search page the we create (from instructions) where the user can search from the last xx days. Simple and easy enough.

Credits go to c-pr0mpt and the search days hack by Vincent "MW" Chan who created two hacks which I modified into one to suit my needs.

***pretty easy hack just requires some php pages to be changed and a few template changes****

Mike

ps...instructions are in html format

please note- this hack has been updated on May 4, 2003 to include suggestions in the threads below

Velocd
04-27-2002, 06:07 PM
*confused*

Picture, demo, or anything? (I think pictures/demo's should be required with every new hack)

Lesane
04-27-2002, 06:21 PM
Look at his online demo, what more do you want?

Great hack indiamike, i will install this one later. Thanks.

inetd
04-27-2002, 06:27 PM
good hack ;)
download allready, insatall one later ;)

indiamike
04-27-2002, 07:03 PM
Originally posted by Velocd
*confused*

Picture, demo, or anything? (I think pictures/demo's should be required with every new hack)

A picture speaks a thousand words but having a demo that works and someone can check it out is also good.

So there is no confusion :confused:

Here is the link to my search page where I added the link to the day search
Search Page (http://www.indiamike.com/india/search.php)

Here is the page that the hack creates to search by xx days
Day Search (http://www.indiamike.com/india/daysearch.php)

John
04-27-2002, 07:23 PM
I have to say, this looks like a really good hack - sometimes "View New Posts" can can a pain because it times out and resets - I'll install later on :)

Smoothie
04-27-2002, 08:49 PM
I just downloaded it and i am about to install, but one quick question. When you search by x number of days, does it not show private forums? Wanted to find out before i added this.

indiamike
04-27-2002, 09:14 PM
All this hack basically does is copy your present search.php file to a new php file and change one line to show by the amount by days instead of getting new posts. So the answer would be if your present search function doesn't show private forums then your new day search wouldn't show them either (and vice versa).

In reality the whole hack is a no-brainer hack and I am quite surprised that no one thought of doing this before. :ermm:

Mike

Velocd
04-27-2002, 10:03 PM
oh, mybad I must have skipped the link to the demo in your first post when reading. ok, now I see. very nice :D

Smoothie
04-28-2002, 04:11 PM
Yep. Installed and loving it. Thanks for posting this hack.

julius
04-29-2002, 07:29 PM
Good hack, thank you, I have already installed it!

Scrooge
04-29-2002, 08:35 PM
Is it possible to exclude forums that a regular search would find? I have Usenet Groups on my site but would like this hack to just show results from my regular forums.

indiamike
04-29-2002, 08:52 PM
Originally posted by Scrooge
Is it possible to exclude forums that a regular search would find? I have Usenet Groups on my site but would like this hack to just show results from my regular forums.

Doubtful, since this hack basically just copies your present search.php, unless someone has come up with a way of excluding usenet groups from the search function, which last time I checked no one has. So this may not work well with Usenet groups.

Hope this helps.

Mike

Ordovicium
06-14-2002, 11:54 AM
Thanx!!!
Nice Hack :)

Birdie501
06-14-2002, 12:33 PM
Hi,
nice hack! Is it possible to have a field in User CP where the user can define how many days he normally wanted to show?
Maybe there could be a dropdown field with 1-x days and one called "variable". if this is choosen the user can enter the value in the template.???

Thanks.

-=dm=-
06-14-2002, 12:41 PM
thanx indiamike looks great.
btw nice forum :)

going to install this one:D

Rand M
04-20-2003, 10:46 AM
Thanks IndiaMike , just what my (ab)users have been asking for.

jschefdog
05-01-2003, 11:48 PM
Thanks for the great hack, this is exactly what I was looking for. I can't believe that they still haven't added this feature to the standard vbulletin, even in the v3 beta.

I made a few tweaks to the searchinfo template code that you may want to change in the original. I think the following lines have the text in the wrong place. The "To search for all..." text does not appear in the same size or color as the other search page tables.
<td bgcolor="#1D6AA0"><b>To search for all posts by xx days click below</b>
<smallfont color="#EEEEFF"></smallfont></td>
I think this should be:
<td bgcolor="#1D6AA0"><smallfont color="#EEEEFF"><b>To search for all posts by xx days click below</b>
</smallfont></td>
Also, at least on my server, it was not necessary to specify the full URL for the daysearch.php file. The following was sufficient.
<a href="daysearch.php">
This change will eliminate the need for people to modify this line.

indiamike
05-02-2003, 08:38 AM
Thanks for updating some of the hack. It's a way old hack (over a year now) so any additions or corrections are welcome. I will update the file in a few days.

It's such a simpler hack but I still find myself using it after all this time.

Cheers
Mike

jschefdog
05-02-2003, 07:58 PM
Glad to see you're still following this thread. Thanks for making the hack available. I think people will keep using it until the developers add this feature to the standard vbulletin, which it seems they have no interest in adding to v3 at this time.

Of course, shortly after adding this hack, someone asked if there was a way to sort the results. After some tinkering, I figured out how to do this. You need to modify an additional line in the search2.php file as follows. Find the following line in the "Start Get Daily" section of search2.php:
eval("standardredirect(\"".gettemplate("redirect_search")."\",\"search.php?s=$session[sessionhash]&action=showresults
&getnew=true&searchid=$searchid\");");
Change it to:
eval("standardredirect(\"".gettemplate("redirect_search")."\",\"search.php?s=$session[sessionhash]&action=showresults
&getnew=true&searchid=$searchid&sortby=".addslashes($sortby)."&sortorder=".addslashes($sortorder)."\");");

Then use the attached text file for the "lastxxdays" template.

Feel free to add these changes to the hack if you want.

indiamike
05-04-2003, 02:37 PM
Thanks for the additions to this jschefdog. I have updated the original release (bringing it back from the dead) and have incorporated your changes into it.

Thanks

Mike

sraposa
05-15-2003, 07:52 PM
i too want to thank you for putting it together. bravo! it was exactly what we needed given that the vB algorithm for tracking read/unread posts is way screwy and cannot be relied upon.

i called the feature "View Recent Posts" and i included a link to it right next to "View New Posts" on the home page. and although i kept it as a seperate page, i did a little more integration on the regular Search page.

if any one wants to take a peek...

home page: http://www.karma-lab.com/forum
search page: http://www.karma-lab.com/forum/search.php
view recent posts (hack) page: http://www.karma-lab.com/forum/viewrecent.php

-scott

indiamike
05-15-2003, 10:14 PM
Excellent job Scott and a real nice forum.

Cheers
Mike

sraposa
05-19-2003, 02:00 PM
thanks, mike.

also, i just realized that my "Sort By" options weren't working because i had replaced the wrong line in search2.php. the current instructions read:

Next Find: (somewhere between lines 530 to 540 depending on version of vb)

which is actually above the "$days = $daysoption;". not sure about older versions, but in vB2.3.0, the line that needs to get replaced for the sort is just a few lines below the "$days = $daysoption;". and both lines are in the "Get Start Daily" section (which i discovered from jschefdog's post.).

so, at least for 2.3.0, the instructions would be much less prone to errors if they said something like: "go to the ## Get Start Daily ## section. replace the $days = 1 line with... replace the eval() line with ..."

just a suggestion.

thanks again.
-scott

Thoki
03-30-2004, 07:32 AM
Hello,
I´d installed zhis nice hack into my vB2.3 and now I updated to vB3.
What happened? My users are screaming: Where ist the search page?? Is it lost? :-)
So, can anybody tell me how to port this to vB3?

Greets Thoki.

Carter876
04-08-2004, 09:09 AM
Yeah, I would to know if this nice hack is applicable to VBulletin 3.0.0 !

Regards :)

jschefdog
04-21-2004, 12:08 AM
I just posted what I believe is a way to do this version 3. See the thread Search All Posts From Date (Day Search) (https://vborg.vbsupport.ru/showthread.php?t=64172)