Version: 1.00, by jschefdog
Developer Last Online: May 2011
Version: 3.0.0
Rating:
Released: 04-20-2004
Last Update: Never
Installs: 7
Is in Beta Stage
No support by the author.
This is so simple I'm almost embarrased to post it here with all these great hacks, but I did some searching and only found posts from others who were looking for this feature. There is a hack for version 2 called Day Search which allows searching for all posts in the last xx days. I had added this hack for our v2 installation and wanted something similar for v3. After some searching here I didn't find anything, so I started tinkering with the search.php file and found a really simple way to make the standard Search page allow you to do something like this. All you have to do is defeat the test which checks if a keyword or user name was entered in the search form and then stops the search if they are both blank.
If anyone wants to try it, edit the search.php file and search for the following lines (at about line 250).
Code:
// error if no search terms
if (empty($query) AND empty($searchuser) AND empty($replyless))
Replace the "if" statement with the following line
Code:
if (empty($query) AND empty($searchuser) AND empty($replyless) AND ($searchdate == 0))
This will cause the 'searchspecifyterms' message to be bypassed provided the "Find Posts From" field is changed from the default of "Any Date". Actually, it will even work if you just comment out the whole if statement around this line, but then it will return lots of posts if the user leaves it at Any Date.
I can't believe it could be this simple, but I ran some tests and it seems to work. It even works with other search options such as selecting particular forums. I couldn't find any problems with it.
The next step is to figure out how to add some more "Find Posts From" options, such as "Last 2 Days", "Last 3 Days", etc. I haven't had a chance to look into this yet, but suspect it might be possible by changing the search_forum template. If I figure out how to do it I will post it here.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
That's a nice hack, and much more handy and obvious. This is the kind of feature I had hoped would be part of vB 3. To save people the trouble of hunting it down, here is the link.
Specifying the forumid will also include children, which is nice. This would allow adding buttons to do specific searches such as "Last Month for Forum X" or "Last Week for Category Y", but does not provide the flexibility of being able to do "Last X Days" searches from the Advanced Search form. With the hack described in this thread, you can select any combination of forums (thanks to the great new search features in vb 3) and then view all the posts from the last x days in those forums. You can also list the results by posts, which I don't think is possible with getdaily.
So simple, but so useful - qualities of a great hack. Should be included in future versions. I've also added the optional enhancements. It works like a charm.
...With the hack described in this thread, you can select any combination of forums (thanks to the great new search features in vb 3) and then view all the posts from the last x days in those forums. You can also list the results by posts, which I don't think is possible with getdaily.
Thanks so much for posting this. This is exactly the way I need the advanced search in my forum to work. Unfortunately, when I modify the search.php file as described, searching operates just as before--still returning the error if 'key word' and 'user name' fields are left blank.
This is the code I found in my search.php file:
Code:
// error if no search terms
if (empty($vbulletin->GPC['query']) AND empty($vbulletin->GPC['searchuser']) AND empty($vbulletin->GPC['replyless']))
and this is what I changed it to:
Code:
// error if no search terms
if (empty($vbulletin->GPC['query']) AND empty($vbulletin->GPC['searchuser']) AND
empty($vbulletin->GPC['searchdate == 0']) AND empty($vbulletin->GPC['replyless']))
I'm running vBulletin 3.6.4 btw.
Is there some other setting I need to change? Thanks.