vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   General Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=189)
-   -   last 48 hours search (https://vborg.vbsupport.ru/showthread.php?t=80880)

whodah 05-01-2005 10:00 PM

last 48 hours search
 
what this hack does: shows the last 48 hours worth of posts
difficulty to install (scale of 1 to 10, 10 being the hardest): 3
files to mod: 1
templates to mod: 1

i take no responsibility if this breaks your forums. this probably violates the vB warranty due to a file modification. u break it, u buy it, yaddi yaddi. don't do this hack... having said that... ;)

so the 'New Posts' link doesn't always work... u sign on, u leave w/out reading all the messages, come back, some are marked as read and don't show up on 'New Posts'... things of that nature.

so on our old forum, pnphpbb, i added a search function to show just the last 48 hours of posts.

once we migrated to vB, this had to be the feature i got the most PM's on that my peeps missed!!!

ok, so it's a very easy hack. probably violates a vB warranty, so u break it, u buy it. i take no responsibility, yaddi yaddi..

here we go!

file: forums/search.php
find:
Code:

        if ($_REQUEST['do'] == 'getnew' AND $bbuserinfo['lastvisit'] != 0)
        {
                // if action = getnew and last visit date is set
                $datecut = $bbuserinfo['lastvisit'];
        }
        else
        {
                $_REQUEST['do'] = 'getdaily';
                if ($days < 1)
                {
                        $days = 1;
                }
                $datecut = TIMENOW - (24 * 60 * 60 * $days);
        }

insert the 'elseif' statement right between the if and else as such (or just replace it w/ this code):
Code:

        if ($_REQUEST['do'] == 'getnew' AND $bbuserinfo['lastvisit'] != 0)
        {
                // if action = getnew and last visit date is set
                $datecut = $bbuserinfo['lastvisit'];
        }
        // 2005.04.30 whodah - last 48 hours mod
        elseif ($_REQUEST['do'] == 'last48hours')
  {
                $days = 2;
                $datecut = TIMENOW - (24 * 60 * 60 * $days);
        }
        // end 2005.04.30 whodah - last 48 hours mod
        else
        {
                $_REQUEST['do'] = 'getdaily';
                if ($days < 1)
                {
                        $days = 1;
                }
                $datecut = TIMENOW - (24 * 60 * 60 * $days);
        }

you are done. if you now visit:
Code:

www.yourdomain.com/forums/search.php?do=last48hours
it will show u the last 48 hours worth of posts.

(it should be pretty obvious how to modify it to show the last 7 days or whatever u want. we like 48 hours...)

so now, we added a link to that next to 'New Posts' on our NavBar...

to do this, edit your 'navbar' template. for those that dont' know how:
  • log on to your appliance admin: www.yourdomain.com/forums/admincp
  • click 'Styles & Templates' on the left, then 'Style Manager'.
  • on the right hand menu, drop down to 'Edit Templates' and choose 'Go'.
  • double click 'Navigation / Breadcrumb Templates'
  • double click 'navbar'

somewhere in here, add a link to your new search function. in our case, we put it next to 'New Posts'. to do this, find:
Code:

<td class="vbmenu_control"><a href="calendar.php?$session[sessionurl]">$vbphrase[calendar]</a></td>
afterwards add:
Code:

<td class="vbmenu_control"><a href="search.php?do=last48hours" accesskey="5">Last 48 Hours</a></td>
enjoy! :)

Who Dah?

Zachery 05-02-2005 02:58 PM

whoa.. try

search.php?do=getdaily&days=2

Paul M 05-02-2005 03:27 PM

Quote:

Originally Posted by Zachery
whoa.. try

search.php?do=getdaily&days=2

Just what I was going to say .... :)

whodah 05-02-2005 03:51 PM

(in joking voice)

i don't want to play w/ u anymore...

:P

oh man - i seriously overlooked this functionality... i'll remove the hack, heh!

oh, and thx btw! ;)


All times are GMT. The time now is 07:02 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.03611 seconds
  • Memory Usage 1,727KB
  • 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
  • (5)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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