Back to vBulletin 3.0 Add-Ons

Search By Day Instead of From Day
Mod Version: 1.00, by Ming Keong

This modification is in the archives.
vB Version: 3.0.1 Rating: (0 vote - 0 average) Installs: 2
Released: 31 May 2004 Last Update: Never Downloads: 1
Not Supported  

Search By Day Instead of From Day
By: Ming Keong
Inspiration: index.php?t=64172

Estimated Installation Time: 1-5 mins
File changes: 1 PHP

History
31May04:Initial creation
01Jun04:Added option to retain original getdaily functionality by using getdailyfrom instead

Comments
I'm not sure how many of you will find this useful, but I'll just post it anyway so that it'll benefit anyone who wants it. It's a simple hack that will probably be useful for people who run news sites.

Description
Converts 'getdaily' searches to retrieve posts for the particular day, instead of from the particular day.

getdaily -> Gets all posts X days ago
getdailyfrom -> Gets all posts from X days ago till now

Example Usage
http://www.pdatrends.com/search.php?do=getdaily&days=1&forumid=6 -> Get News 1 Day Ago
http://www.pdatrends.com/search.php?do=getdaily&days=3&forumid=6 -> Get News 3 Days Ago
http://www.pdatrends.com/search.php?do=getdailyfrom&days=1&forumid=6 -> Get News From 1 Day Ago Till Now
http://www.pdatrends.com/search.php?do=getdailyfrom&days=3&forumid=6 -> Get News From 3 Days Ago Till Now

Code Modifications
In search.php:

Find:
PHP Code:
$threads $DB_site->query(
        SELECT threadid 
        FROM " 
TABLE_PREFIX "thread AS thread 
        LEFT JOIN " 
TABLE_PREFIX "deletionlog AS delthread ON(delthread.primaryid = thread.threadid AND delthread.type = 'thread') 
        WHERE forumid IN(" 
implode(', '$forumids) . ") 
        AND thread.lastpost >= 
$datecut 
        AND visible = 1 
        AND delthread.primaryid IS NULL 
        ORDER BY lastpost DESC 
        LIMIT 
$vboptions[maxresults] 
    "
); 
Replace with:
PHP Code:
if ($_REQUEST['do'] == 'getdaily') { 
        
$datecutplus $datecut + (24 60 60); 
        
$dayonly "AND thread.lastpost <= $datecutplus"
    } 
    
$threads $DB_site->query(
        SELECT threadid 
        FROM " 
TABLE_PREFIX "thread AS thread 
        LEFT JOIN " 
TABLE_PREFIX "deletionlog AS delthread ON(delthread.primaryid = thread.threadid AND delthread.type = 'thread') 
        WHERE forumid IN(" 
implode(', '$forumids) . ") 
        AND thread.lastpost >= 
$datecut 
        "
.$dayonly.
        AND visible = 1 
        AND delthread.primaryid IS NULL 
        ORDER BY lastpost DESC 
        LIMIT 
$vboptions[maxresults] 
    "
); 

Optional, if you want to retain the previous getdaily functionality:

Find:
PHP Code:
if ($_REQUEST['do'] == 'getnew' OR $_REQUEST['do'] == 'getdaily'
Replace with:
PHP Code:
if ($_REQUEST['do'] == 'getnew' OR $_REQUEST['do'] == 'getdaily' OR $_REQUEST['do'] == 'getdailyfrom'
Find:
PHP Code:
$_REQUEST['do'] = 'getdaily'
Replace with:
PHP Code:
if ($_REQUEST['do'] != 'getdaily') {
    
$_REQUEST['do'] = 'getdailyfrom';



Known Limitations
- Retrieves x days ago relative to current time. Eg, it cannot retrieve posts for 28 May 2004. If the current time is 12pm on 29 May 2004, retrieving 1 day ago will search for all posts from 28 May 2004 12pm till 29 May 2004 12pm.

Download

This modification is archived and cannot be downloaded.

Similar Mods

Integration with vBulletin Google/Adsense Site Search Integrated into Advanced Search Page vBulletin 3.6 Template Modifications

vblts.ru supports vBulletin®, 2022-2024