![]() |
Search by Date + Range
Is there a hack out there that allows you to specify a date range to search for threads / posts?
|
Anybody ? :)
|
I don't have much knowledge of PHP or SQL, but can anybody shed any light on this? From each forum its possible to view the last posts by xxx days, so all I'm after is something that just searches all forums.
I'd really appreciate any help with this and I'm sure others would fine it useful. |
I'm very interested in this feature also. Member why-not posted this excellent hack for vB 3.0 here:
https://vborg.vbsupport.ru/showthread.php?t=74830 I tried to apply it to vB 3.6, but there are too many code changes in search.php for a non-web developer to implement. Anybody have this hack running on vB 3.6? Thanks. |
You can submit a search to vBulletin with a URL, just like you can with the search form. http://www.yourforums/search.php?do=process&query=searchword , where searchword is the word for which you are searching.
Here is a list of the extra search parameters you can add to the URL. When you add a search parameter to the URL you need to add this to the end of the URL: &variable_name=valueSearch field: Search by Key Word Variable name: titleonly Values:
Variable name: searchuser Values: Enter a username Variable name: starteronly Values:
Values:
Variable name: replyless Values:
Values: Any integer values Search field: Find Posts from Variable name: searchdate Values:
Values:
Variable name: sortby Values:
Values:
Variable name: showposts Values:
Variable name: forumchoice[] Values: Do not include this variable in the URL to search all forums. If you want to search specific forums then you need to add an instance for each forumid. For example: &forumchoice[]=X&forumchoice[]=Y&forumchoice[]=ZWhere X, Y, and Z are the forumids of the forums in which you want to search. Variable name: childforums Values:
|
Thanks for the url search terms, geartripper. My requirement is that I print all posts over a 1 week period in selected forums, and the searchword always trips me up. That url command requires a searchword doesn't it? (My advanced search function is hacked so that it will allow searches without a searchword or user name.)
Maybe getdaily&days would work, but I don't know all the options of that command. Will getdaily&days display posts, not threads? |
i have a similar problem here - on a certain date there were over 200 new threads in my forum - compared to the average of 20-30 and i want to pull all those threads and see what they were... is there a way to do this with the search options? i dont see any way to put in a date range...
i tried building a query http://www.vfxtalk.com/forum/search....by=threadstart but it wont let me do a search without a query - which i need to d osince i dont know whats in those threads, ie the following wont work... http://www.vfxtalk.com/forum/search....by=threadstart any help would be really cool! |
I gotta say I'm *astounded* that this basic search capability of getting ALL posts within a given date range is not built in to vBulletin. WTF???
This has been around in other Forum software since 1995 (e.g. then-O'Reilly WebBoard). Requiring some keyword to be part of any date-range search automatically reduces the results so you don't get all. Will SOMEBODY please post a hack for this in vBulletin??? Thanks from this shocked newbie. HJ PS: If the hack is a url call, please include an example URL for us non-techies. Thanks! |
i too need a hack to hav the search by date option ...
has anybdy been able to do it for the 3.5.x versions. plz reply if nybdy has found out the solution to it.. |
hey guys.....i have derived the solution for searching threads/posts by date range..
it requires some changes...the code is under test and will be uploaded in a few days. :):up: |
Was this mod ever released? I couldn't find it. Thanks in advance.
|
what mod is that?
|
Quote:
| | | | V Quote:
|
1 Attachment(s)
hey am sorry i culdnt gve u the mod in time......i was away for some time....
Now these are the changes i hav done to implement search by date range... i suggest u take a backup of yuor files before changing nything... Follow the steps carefully and you would achieve your results : Steps --------- A ) Change is Template files Changes in search_forums template _________________________ 1 : ) At the start line no : 1 ...Add Code : <!-- Punterz search b/w date range 12/03/2008 --> <LINK href="css/calendar-blue.css" type="text/css" rel="stylesheet"> <script src="js/calendar.js" type="text/javascript"></script> <script src="js/calendar-en.js" type="text/javascript"></script> <script src="js/calendar-setup.js" type="text/javascript"></script> <script type="text/javascript"> function check1() { if (vbform.s_opt1.checked==true) { vbform.soptdate.readOnly=true; vbform.eoptdate.readOnly=true; vbform.soptdate.title=""; vbform.eoptdate.title=""; vbform.triggerFrom.disabled=true; vbform.triggerTo.disabled=true; vbform.triggerFrom.style.visibility="hidden"; vbform.triggerTo.style.visibility="hidden"; vbform.searchdate.disabled=false; vbform.beforeafter.disabled=false; } else if (vbform.s_opt2.checked==true) { vbform.soptdate.readOnly=false; vbform.eoptdate.readOnly=false; vbform.triggerFrom.disabled=false; vbform.triggerTo.disabled=false; vbform.triggerFrom.style.visibility="visible"; vbform.triggerTo.style.visibility="visible"; vbform.soptdate.title="Click the adjacent Calender image to select the From Date"; vbform.eoptdate.title="Click the adjacent Calender image to select the To Date"; vbform.searchdate.disabled=true; vbform.beforeafter.disabled=true; } } </script> <script type="text/javascript"> function enab() { vbform.soptdate.disabled=true; vbform.eoptdate.disabled=true; vbform.soptdate.value=""; vbform.eoptdate.value=""; vbform.soptdate.title=""; vbform.eoptdate.title=""; vbform.triggerFrom.disabled=true; vbform.triggerTo.disabled=true; vbform.triggerFrom.style.visibility="hidden"; vbform.triggerTo.style.visibility="hidden"; vbform.searchdate.disabled=false; vbform.beforeafter.disabled=false; } </script> <script type="text/javascript"> function enab1() { vbform.soptdate.disabled=false; vbform.eoptdate.disabled=false; vbform.soptdate.readOnly=true; vbform.eoptdate.readOnly=true; vbform.triggerFrom.style.visibility="visible"; vbform.triggerTo.style.visibility="visible"; vbform.soptdate.title="Click the adjacent Calender image to select the From Date"; vbform.eoptdate.title="Click the adjacent Calender image to select the To Date"; vbform.triggerFrom.disabled=false; vbform.triggerTo.disabled=false; vbform.searchdate.disabled=true; vbform.beforeafter.disabled=true; } </script> <!-- Punterz search b/w date range 12/03/2008 --> 2:) At line no : 84 Replace <body> with : <body onLoad="check()"> 3:) At line no : 371 After </form> tag Add this Code : <!-- Punterz search b/w date range 12/03/2008 --> <script type="text/javascript"> Calendar.setup( { inputField : "soptdate", // ID of the input field ifFormat : "%Y-%m-%d", // the date format button : "triggerFrom" // ID of the button } ); </script> <script type="text/javascript"> Calendar.setup( { inputField : "eoptdate", // ID of the input field ifFormat : "%Y-%m-%d", // the date format button : "triggerTo" // ID of the button } ); <!-- Punterz search b/w date range 12/03/2008 --> </script> 4:) At line no : 217. Starting with : <fieldset class="fieldset"> <div style="padding:$stylevar[formspacer]px"> <legend>$vbphrase[find_posts_from]</legend> .....................................till......... ..................... </fieldset> Replace this fieldset to fieldset code with : <fieldset class="fieldset"> <div style="padding:$stylevar[formspacer]px"> <legend>$vbphrase[find_posts_from]</legend> <div style="padding:$stylevar[formspacer]px"> <input type='radio' name='find_opt' value='0' $find_optchecked[0] onClick="enab()" id="s_opt1" checked="true"/> Previous Visits </div> <br> <div align='left'> &n bsp; <select name="searchdate" style="width:150px" id="searchdate"> <option value="0" $searchdateselected[0]>$vbphrase[any_date]</option> <option value="lastvisit" $searchdateselected[lastvisit]>$vbphrase[your_last_visit]</option> <option value="1" $searchdateselected[1]>$vbphrase[yesterday]</option> <option value="7" $searchdateselected[7]>$vbphrase[a_week_ago]</option> <option value="14" $searchdateselected[14]><phrase 1="2">$vbphrase[x_weeks_ago]</phrase></option> <option value="30" $searchdateselected[30]>$vbphrase[a_month_ago]</option> <option value="90" $searchdateselected[90]><phrase 1="3">$vbphrase[x_months_ago]</phrase></option> <option value="180" $searchdateselected[180]><phrase 1="6">$vbphrase[x_months_ago]</phrase></option> <option value="365" $searchdateselected[365]>$vbphrase[a_year_ago]</option> </select> &n bsp; &nbs p; <select name="beforeafter"> <option value="after" $beforeafterselected[after]>$vbphrase[and_newer]</option> <option value="before" $beforeafterselected[before]>$vbphrase[and_older]</option> </select> </div> <!-- Select --> <br> <hr width=95% color="#D0D0BF"> <!-- Select Range Punterz Search by Date Range 12/03/2008--> <div style="padding:$stylevar[formspacer]px"> <input type='radio' name='find_opt' value='1' id="s_opt2" $find_optchecked[1] onClick="enab1()"/> Select Range </div> <br> <div width='100%' style="text-align: center"> <table width='100%' cellpadding='1' cellspacing='0' align='center' z-index="-1"> <tr> <td width="50%"> From : <input type="text" class="bginput" style="font-size:11px" name="soptdate" size="10" maxlength="10" id="soptdate" align="center" value="$soptdate" /> <!-- aaa --> <img src="images/cal.gif" width="16" height="16" border="0" alt="Click Here to Select From Date" id="triggerFrom" style="visibility:hidden" style="cursor: pointer;" > </td> <td width="50%"> &n bsp; To : <input type="text" class="bginput" style="font-size:11px" name="eoptdate" size="10" maxlength="10" id="eoptdate" align="center" value="$eoptdate" /> <!-- aaa --> <img src="images/cal.gif" width="16" height="16" border="0" alt="Click Here to Select To Date" id="triggerTo" style="visibility:hidden" style="cursor: pointer;"> </td> </tr> <tr> <td colspan='2' height='18'>$vbphrase[date_format]$conf_dformat</td> </tr> </table> </div> <!-- Punterz search b/w date range 12/03/2008 --> </fieldset> --------------------------------------------------------------------------------------------------------- Changes made to search.php ___________________________ 1: ) Add the code aftre line no : 91 'soptdate' => TYPE_STR, 'eoptdate' => TYPE_STR, 'find_opt' => TYPE_STR, 2 : ) At line no 1424 replace this : //$thread_select_logic[] = "DISTINCT thread.threadid"; with this : $thread_select_logic[] = "DISTINCT thread.threadid,thread.dateline"; 3 : ) At line no : 1282 search for : a. // check if we are searching for posts from a specific time period b.// check to see if there are conditions attached to number of thread replies Replace any code between a and b with this : if (($vbulletin->GPC['find_opt'])==0) { if ($vbulletin->GPC['searchdate'] != 'lastvisit') { $vbulletin->GPC['searchdate'] = intval($vbulletin->GPC['searchdate']); } if ($vbulletin->GPC['searchdate']) { switch($vbulletin->GPC['searchdate']) { case 'lastvisit': // get posts from before/after last visit $datecut = $vbulletin->userinfo['lastvisit']; break; case 0: // do not specify a time period $datecut = 0; break; default: // get posts from before/after specified time period $datecut = TIMENOW - $vbulletin->GPC['searchdate'] * 86400; } if ($datecut) { switch($vbulletin->GPC['beforeafter']) { // get posts from before $datecut case 'before': $post_query_logic[] = "post.dateline < $datecut"; break; // get posts from after $datecut default: $post_query_logic[] = "post.dateline > $datecut "; } } unset($datecut); } } // ################################################## ########################### else if (($vbulletin->GPC['find_opt'])==1) { $fromdate= "'".$vbulletin->GPC['soptdate']."'"; $todate = "'".$vbulletin->GPC['eoptdate']."'"; $post_query_logic[] = "date(FROM_UNIXTIME(thread.dateline)) >= $fromdate AND date(FROM_UNIXTIME(thread.dateline)) <= $todate"; } Upload calender-blue.css in your CSS folder Upload calender.js, calender-en.js and calender-setup.js is your js folder and cal.gif in your images folder These files are available in files.zip as an attachment in this post. Do let me know if u face any problems. |
All times are GMT. The time now is 03:04 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|