Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > General Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
last 48 hours search
whodah
Join Date: Feb 2004
Posts: 77

 

Show Printable Version Email this Page Subscription
whodah whodah is offline 05-01-2005, 10:00 PM

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

whoa.. try

search.php?do=getdaily&days=2
Reply With Quote
  #3  
Old 05-02-2005, 03:27 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery
whoa.. try

search.php?do=getdaily&days=2
Just what I was going to say ....
Reply With Quote
  #4  
Old 05-02-2005, 03:51 PM
whodah whodah is offline
 
Join Date: Feb 2004
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

(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!
Reply With Quote
Reply


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 01:01 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.05339 seconds
  • Memory Usage 2,224KB
  • Queries Executed 17 (?)
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
  • (5)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (4)postbit_onlinestatus
  • (4)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete