vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Search by Date + Range (https://vborg.vbsupport.ru/showthread.php?t=49608)

Intex 03-03-2003 08:45 PM

Search by Date + Range
 
Is there a hack out there that allows you to specify a date range to search for threads / posts?

Intex 03-31-2003 09:54 AM

Anybody ? :)

Intex 06-15-2003 04:23 PM

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.

jksgvb 02-07-2007 02:53 PM

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.

SCRIPT3R 02-07-2007 04:51 PM

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=value
Search field: Search by Key Word

Variable name: titleonly
Values:
  • 0 = Search Entire Posts
  • 1 = Search Titles Only
Search field: Search by User Name

Variable name: searchuser
Values: Enter a username

Variable name: starteronly
Values:
  • 0 = Find Posts by User
  • 1 = Find Threads Started by User
Variable name: exactname
Values:
  • 0 = Partial name
  • 1 = Exact name
Search field: Find Threads with

Variable name: replyless
Values:
  • 0 = At Least
  • 1 = At Most
Variable name: replylimit
Values: Any integer values

Search field: Find Posts from

Variable name: searchdate
Values:
  • 0 = Any Date
  • lastvisit = Your Last Visit
  • 1 = Yesterday
  • 7 = A Week Ago
  • 14 = 2 Weeks Ago
  • 30 = A Month Ago
  • 90 = 3 Months Ago
  • 180 = 6 Months Ago
  • 365 = A Year Ago
Variable name: beforeafter
Values:
  • after = and Newer
  • before = and Older
Search field: Sort Results by

Variable name: sortby
Values:
  • rank = Relevancy
  • title = Title
  • replycount = Number of Replies
  • views = Number of Views
  • threadstart = Thread Start Date
  • lastpost = Last Posting Date
  • postusername = User Name
  • forum = Forum
Variable name: order
Values:
  • descending = in Descending Order
  • ascending = in Ascending Order
Search field: Show Results as

Variable name: showposts
Values:
  • 0 = Show Results as Threads
  • 1 = Show Results as Posts
Search field: Search in Forum(s)

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[]=Z
Where X, Y, and Z are the forumids of the forums in which you want to search.

Variable name: childforums
Values:
  • 0 = Do not search in child forums
  • 1 = Also search in child forums

jksgvb 02-08-2007 05:18 AM

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?

jahshaka 03-30-2007 10:28 AM

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!

HydraulicJack 03-30-2007 08:20 PM

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!

TMS_Hon 02-15-2008 12:14 PM

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..

TMS_Hon 03-24-2008 10:50 AM

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:

YLP1 04-28-2008 07:59 PM

Was this mod ever released? I couldn't find it. Thanks in advance.

MissKalunji 04-28-2008 08:01 PM

what mod is that?

YLP1 04-28-2008 10:36 PM

Quote:

Originally Posted by MissKalunji (Post 1501737)
what mod is that?

This one --- Unless I misunderstood --- I was looking for a mod to allow for searching by specific date.
|
|
|
|
V

Quote:

Originally Posted by TMS_Hon (Post 1473176)
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:


TMS_Hon 06-11-2008 09:46 AM

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"/>
&nbsp; Previous Visits
</div>
<br>
<div align='left'>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<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>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;
<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()"/>&nbsp;
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%">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
From : &nbsp;<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%">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;
To : &nbsp;<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
  • Page Generation 0.01322 seconds
  • Memory Usage 1,805KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (14)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete