The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Search All Posts From Date (Day Search) Details »» | |||||||||||||||||||||||||
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)) Code:
if (empty($query) AND empty($searchuser) AND empty($replyless) AND ($searchdate == 0)) 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
|
Comments |
#2
|
|||
|
|||
OK, I figured out how to add more options to the "Find Posts From" drop down in the Search form. From the admin page, open the Style Manager and choose Edit Templates for the style you want to change. Expand "Search Templates" then select the search_forums template under it. Click Customize.
Search for the following line in this template. Code:
<option value="1" $searchdateselected[1]>$vbphrase[yesterday]</option> Code:
<option value="2" $searchdateselected[2]><phrase 1="2">$vbphrase[x_days_ago]</phrase></option> <option value="3" $searchdateselected[3]><phrase 1="3">$vbphrase[x_days_ago]</phrase></option> <option value="4" $searchdateselected[4]><phrase 1="4">$vbphrase[x_days_ago]</phrase></option> <option value="5" $searchdateselected[5]><phrase 1="5">$vbphrase[x_days_ago]</phrase></option> I was surprised to find out that there was already a "x_days_ago" phrase provided in vBulletin, even though they don't use it in the standard "Find Posts From" drop down. It seems that everything needed to search for all posts in the last X days is in standard vBulletin 3.0.0, but for some reason they did not allow it. |
#3
|
|||
|
|||
looking good m8 and u r right in what u say but this sort of stuff should already of been built into vb in first place.
Job well done m8 |
#4
|
||||
|
||||
What lasto said,
search.php?do=getdaily or search.php?do=getdaily&days= |
#5
|
|||
|
|||
Quote:
cheers Zachery - so with this then theirs no need for the hack above. |
#6
|
|||
|
|||
Quote:
My question is, since this hack works, why does the standard search.php code block it by cancelling any search that doesn't include a keyword or user name? |
#7
|
|||
|
|||
I've already posted something simular in another thread, no need to change any thing just put this code where you want the search box to show, like forum home
Code:
<form action="search.php" method="get" name="name"> <input type="hidden" name="do" value="getdaily"> Search for posts from the last <input type="text" value="1" name="days" size="3"> day(s) <input type="submit" value="Search"> </form> |
#8
|
||||
|
||||
Quote:
|
#9
|
|||
|
|||
Here are a couple of optional enhancements to the hack. If you want to block this type of search for a time period longer than a few days, you can modify the line listed in the first post to something like:
Code:
if (empty($query) AND empty($searchuser) AND empty($replyless) AND (($searchdate == 0) OR ($searchdate > 7))) Also, if you want to change the message that pops up if the user doesn't set "Find Posts From" to an acceptable value, you need to use the Phrase Manager.
Quote:
|
#10
|
|||
|
|||
Quote:
http://www.vbulletin.com/forum/showthread.php?p=657712 The only real advantage my hack has is that it provides more search control, such as only showing recent posts in selected forums. |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|