Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Beta Releases

Reply
 
Thread Tools
Search All Posts From Date (Day Search) Details »»
Search All Posts From Date (Day Search)
Version: 1.00, by jschefdog jschefdog is offline
Developer Last Online: May 2011 Show Printable Version Email this Page

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.

Comments
  #2  
Old 04-21-2004, 03:56 PM
jschefdog jschefdog is offline
 
Join Date: May 2002
Location: Sunnyvale, CA.
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Then add lines similar to the following after this line:
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>
This will add options "2 Days Ago", "3 Days Ago", etc. You don't need to add all these options, or you can set other numbers of days if desired, but make sure to change the number in all 3 locations of the line. Each option line will add one drop down choice.

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.
Reply With Quote
  #3  
Old 04-21-2004, 04:05 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 04-21-2004, 04:09 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What lasto said,

search.php?do=getdaily
or
search.php?do=getdaily&days=
Reply With Quote
  #5  
Old 04-21-2004, 04:28 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery
What lasto said,

search.php?do=getdaily
or
search.php?do=getdaily&days=
wow they work - i never knew they where adding in vb to be honest.I posted a request for this a while back but it went unanswered as usual so i just naturally assumed they were`nt built in but obvious they are

cheers Zachery - so with this then theirs no need for the hack above.
Reply With Quote
  #6  
Old 04-21-2004, 04:54 PM
jschefdog jschefdog is offline
 
Join Date: May 2002
Location: Sunnyvale, CA.
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by lasto
so with this then theirs no need for the hack above.
I don't agree that the availability of "getdaily" makes this hack unecessary. This command was available in version 2 and the Day Search hack was built around it. But to use it you have to remember the syntax and type it into your browser. This is not something you should expect all the forum users to figure out and remember. The whole point of the Day Search hack was to add a way to access this function from the UI. The above hack is much simpler to implement and provides access to all the other search options (picking forums, sorting, etc).

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?
Reply With Quote
  #7  
Old 04-21-2004, 05:08 PM
Beermonster Beermonster is offline
 
Join Date: Dec 2003
Location: England
Posts: 362
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #8  
Old 04-21-2004, 05:12 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Beermonster
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>
You can make a simple DHTML drop down to do this for you infact wayne luke has posted one at vB.com
Reply With Quote
  #9  
Old 04-21-2004, 05:25 PM
jschefdog jschefdog is offline
 
Join Date: May 2002
Location: Sunnyvale, CA.
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)))
This example will not allow the search if Any Date is selected, or any option greater than "a week ago" is selected (7 days). You can change the 7 to any number of days you want.

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.
  1. In the admin page, open Phrase Manager under Languages and Phrases.
  2. Click Search In Phrases
  3. Enter searchspecifyterms in Search for Text and change Search In to Phrase Variable Name Only.
  4. Click Find
  5. Click Edit.
  6. Enter the text that you want to appear in this message.
For example, if you uses the above 7 day limit, you might want to change the message text to something like.
Quote:
Please specify some keywords or valid user names to search on, or leave them blank and set Find Posts From to a value between Yesterday and A Week Ago to view all recent posts. There were no matches for your settings.
Reply With Quote
  #10  
Old 04-21-2004, 05:54 PM
jschefdog jschefdog is offline
 
Join Date: May 2002
Location: Sunnyvale, CA.
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery
You can make a simple DHTML drop down to do this for you infact wayne luke has posted one at vB.com
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.

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.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:48 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05808 seconds
  • Memory Usage 2,302KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (7)bbcode_code
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete