[2.0.17] Search latest 24h 48h 72h

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
20
91%
Very Good
1
5%
Good
1
5%
Fair
0
No votes
Poor
0
No votes
 
Total votes: 22

devinliao
Registered User
Posts: 92
Joined: Wed Jun 29, 2005 1:58 am

Post by devinliao » Fri Jul 01, 2005 8:54 am

ok, then

thes will help you http://www.phpbb.com/kb/article.php?article_id=150

in the http://www.phpbb.com/kb/list_articles.php?category_id=7

support page.

Just make sure you do everything right.

or easy mod may do the thingy for you.

Cross_+_Flame
Registered User
Posts: 295
Joined: Wed Oct 30, 2002 3:37 pm
Location: Okie-homa!
Contact:

Post by Cross_+_Flame » Sun Jul 17, 2005 6:38 pm

Installed it and it works perfectly. Thank you! :D

Is there a way to get the results in "post" form, rather than in "thread" form? I'd like to see the last 24 hours of posts, not the threads they were posted in.

Thanks for the consideration!

markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux » Sun Jul 17, 2005 7:24 pm

Within the code added by this MOD in search.php...

FIND:

Code: Select all

$show_results = 'topics';
REPLACE WITH:

Code: Select all

$show_results = 'posts';
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)

User avatar
MoLew
Registered User
Posts: 198
Joined: Fri Jul 05, 2002 7:52 pm
Location: Minnesota, U.S.A.

Post by MoLew » Sat Jul 23, 2005 6:21 am

Excellent! This is just the mod I was looking for.

I've been meaning to add the "Keep Unread Flags" mod, but every time I open it up my eyes glaze over.... :roll: I'm sure it's a fantastic mod and I still intend to add it, but in the meantime this one should help out quite a bit.

With the recent updates in the search functions, it was no longer possible to search for "**" in the last 24 hours without returning errors or blank pages. Now if a user logs in, then has to depart before he's read all the recent posts, it's fairly easy for him to pick up where he left off.

The only thing I can think of to improve this (in my own case anyway) would be to have more recent search times (two, four, eight and 12 hours) added also.

User avatar
MoLew
Registered User
Posts: 198
Joined: Fri Jul 05, 2002 7:52 pm
Location: Minnesota, U.S.A.

Post by MoLew » Sat Jul 23, 2005 6:46 pm

Excellent, this is working quite well and I've even made some minor changes to enable searching for new posts within the last 2, 4, 8, and 12 hours, in addition to the default 24, 48, and 72 hours. As I described above, this will help a great deal with finding new-ish posts that the user didn't have time to read.

The neat part about this is that you don't need *all* the search-hours listed, just use whichever ones you think you'll need. Leave out any un-wanted hour links from the template file edit below.

~~~

Here's an edited version of the mod's instruction text, with my changes in place (I make no claims of this edited version being EasyMod compliant!!):

Code: Select all

##############################################################
## MOD Title: Search latest 24h 48h 72h
## MOD Author: markus_petrux < nospam@phpmix.com > (Markus) http://www.phpmix.com
## MOD Description: This MOD adds a new search feature so it allows to search for
##                  posts from latest 24, 48 or 72 hours (results as topics).
## MOD Version: 1.0.2
##
## Installation Level: (Easy)
## Installation Time: 5 Minutes
## Files To Edit: 4
##		language/lang_english/lang_main.php
##		includes/page_header.php
##		templates/subSilver/index_body.tpl
##		search.php
## Included Files: none
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## - MOD related comments:
##   Tested with phpBB 2.0.15
##   This MOD is EasyMOD friendly.
##
##############################################################
## MOD History:
##
## 2005/06/17 - 1.0.2
##	- Changed the way the links are constructed, so all HTML/CSS attributes
##    are now moved to the template, for easy adaption to other styles.
##
## 2005/01/31 - 1.0.0
##	- Initial release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#------[ OPEN ]--------------------------------------
#
language/lang_english/lang_main.php
#
#------[ FIND ]--------------------------------------
#
//
// That's all, Folks!
// -------------------------------------------------
#
#------[ BEFORE, ADD ]-----------------------------
#
//+MOD: Search latest 24h 48h 72h
$lang['Search_latest'] = "View latest";
// Begin additions by MoLew
$lang['Search_latest_2h'] = "2h";
$lang['Search_latest_4h'] = "4h";
$lang['Search_latest_8h'] = "8h";
$lang['Search_latest_12h'] = "12h";
// End MoLew's additions
$lang['Search_latest_24h'] = "24h";
$lang['Search_latest_48h'] = "48h";
$lang['Search_latest_72h'] = "72h";
//-MOD: Search latest 24h 48h 72h

#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]-----------------------------------------
# NOTE --- the following is a partial search. The line should something like this:
#	'L_WHOSONLINE_MOD' => sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>'),
#
'L_WHOSONLINE_MOD' =>
#
#-----[ AFTER, ADD ]----------------------------------
#
//+MOD: Search latest 24h 48h 72h
	'L_SEARCH_LATEST' => $lang['Search_latest'],
// Begin additions by MoLew
	'L_SEARCH_LATEST_2H' => $lang['Search_latest_2h'],
	'U_SEARCH_LATEST_2H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=2'),
	'L_SEARCH_LATEST_4H' => $lang['Search_latest_4h'],
	'U_SEARCH_LATEST_4H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=4'),
	'L_SEARCH_LATEST_8H' => $lang['Search_latest_8h'],
	'U_SEARCH_LATEST_8H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=8'),
	'L_SEARCH_LATEST_12H' => $lang['Search_latest_12h'],
	'U_SEARCH_LATEST_12H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=12'),
// End additions by MoLew	
	'L_SEARCH_LATEST_24H' => $lang['Search_latest_24h'],
	'U_SEARCH_LATEST_24H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=24'),
	'L_SEARCH_LATEST_48H' => $lang['Search_latest_48h'],
	'U_SEARCH_LATEST_48H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=48'),
	'L_SEARCH_LATEST_72H' => $lang['Search_latest_72h'],
	'U_SEARCH_LATEST_72H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=72'),
//-MOD: Search latest 24h 48h 72h
#
#-----[ OPEN ]-----------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]-----------------------------------------
#
		<a href="{U_SEARCH_UNANSWERED}" class="gensmall">{L_SEARCH_UNANSWERED}</a></td>
#
#------[ BEFORE, ADD ]-----------------------------
#
# This entire section edited by MoLew!
#
		{L_SEARCH_LATEST}<br />
		<a href="{U_SEARCH_LATEST_2H}" class="gensmall">{L_SEARCH_LATEST_2H}</a>&nbsp;<a href="{U_SEARCH_LATEST_4H}" class="gensmall">{L_SEARCH_LATEST_4H}</a>&nbsp;<a href="{U_SEARCH_LATEST_8H}" class="gensmall">{L_SEARCH_LATEST_8H}</a>&nbsp;<a href="{U_SEARCH_LATEST_12H}" class="gensmall">{L_SEARCH_LATEST_12H}</a>&nbsp;<br />
		<a href="{U_SEARCH_LATEST_24H}" class="gensmall">{L_SEARCH_LATEST_24H}</a>&nbsp;<a href="{U_SEARCH_LATEST_48H}" class="gensmall">{L_SEARCH_LATEST_48H}</a>&nbsp;<a href="{U_SEARCH_LATEST_72H}" class="gensmall">{L_SEARCH_LATEST_72H}</a><br />

#
#-----[ OPEN ]------------------------------------------------
#
search.php
# 
#-----[ FIND ]----------------------------------------- 
# 
	//
	// Cycle through options ...
	//
	if ( $search_id == 'newposts' ||
#
# NOTE --- the previous is a partial search. The line should something like this:
#	if ( $search_id == 'newposts' || $search_id == 'egosearch' || $search_id == 'unanswered' || $search_keywords != '' || $search_author != '' ) 
#
#
#-----[ IN-LINE FIND ]----------------------------------------
#
$search_id == 'newposts'
# 
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
 || $search_id == 'latest'
# 
#-----[ FIND ]----------------------------------------- 
# 
		if ( $search_id == 'newposts' ||
#
# NOTE --- the previous is a partial search. The line should something like this:
#		if ( $search_id == 'newposts' || $search_id == 'egosearch' || ( $search_author != '' && $search_keywords == '' )  )
#
#
#-----[ IN-LINE FIND ]----------------------------------------
#
$search_id == 'newposts'
# 
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
 || $search_id == 'latest'
#
#-----[ FIND ]------------------------------------------------
#
			else if ( $search_id == 'egosearch' )
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
# Original Mod Lines:
#
# //+MOD: Search latest 24h 48h 72h
# 			else if ( $search_id == 'latest' )
# 			{
# 				$latest_hours = intval( isset($HTTP_GET_VARS['hours']) ? $HTTP_GET_VARS['hours'] : 24 );
# 				$latest_hours = ( ( $latest_hours == 24 || $latest_hours == 48 || $latest_hours == 72 ) ? $latest_hours : 24 );
# 
# 				$sql = "SELECT post_id 
# 					FROM " . POSTS_TABLE . " 
# 					WHERE post_time > " . ( time() - ($latest_hours * 60 * 60) );
# 
# 				$show_results = 'topics';
# 				$sort_by = 0;
# 				$sort_dir = 'DESC';
# 			}
# //-MOD: Search latest 24h 48h 72h
#
# Mod lines edited by MoLew:
#

//+MOD: Search latest 24h 48h 72h
			else if ( $search_id == 'latest' )
			{
				$latest_hours = intval( isset($HTTP_GET_VARS['hours']) ? $HTTP_GET_VARS['hours'] : 2 );
				$latest_hours = ( ( $latest_hours == 2 || $latest_hours == 4 || $latest_hours == 8 || $latest_hours == 12 || $latest_hours == 24 || $latest_hours == 48 || $latest_hours == 72 ) ? $latest_hours : 2 );

				$sql = "SELECT post_id 
					FROM " . POSTS_TABLE . " 
					WHERE post_time > " . ( time() - ($latest_hours * 60 * 60) );

				$show_results = 'posts';
				$sort_by = 0;
				$sort_dir = 'DESC';
			}
//-MOD: Search latest 24h 48h 72h

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Finally, a big Thank You! to markus_petrux for creating this mod, and making it easy enough to bend to my own needs.

markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux » Sat Jul 23, 2005 8:29 pm

Sweet! :)

You might want to look at this:
http://www.phpbb.com/phpBB/viewtopic.php?t=309700

:)
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)

TerraFrost
Former Team Member
Posts: 5957
Joined: Sun Dec 26, 2004 3:40 am
Location: Austin, TX

Post by TerraFrost » Tue Jul 26, 2005 5:36 pm

MOD Updated to version 1.1.0
See first post for Download Link

markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux » Tue Jul 26, 2005 6:01 pm

Thanks for such a quick response :)

I hope people find it easier to customize now.


edited: BTW, fully compatible with CH21x. The ZIP contains upgrade instructions for those who had 1.0.2 installed. And it can be installed with EasyMOD.
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)

njit
Registered User
Posts: 6
Joined: Mon Jan 24, 2005 2:42 pm

Post by njit » Fri Aug 05, 2005 4:43 pm

The MOD works fine but i would rather show something like
1 day, 2 days, Last week, last 2 weeks, last month, last 6 months

I can ofcourse calculate the number of hours but it is not very userfriendly to show something like: 744 hours (1 month)

Is this possible??

markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux » Sat Aug 06, 2005 1:17 am

ugh, I didn't thought about that.

When I find the time, I'll try to create a new version...
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)

topiz
Registered User
Posts: 9
Joined: Fri Jun 24, 2005 12:40 am

Post by topiz » Fri Aug 26, 2005 7:18 pm

it is ok, thank you! just what i've been looking for... but there will be a way to make this code in a easier way than the "phpmyadmin" page?
(i don't have that program installed in my server :oops: )

Code: Select all

#
#------[ SQL ]--------------------------------------
#
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_latest_hours', '24,48,72');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_latest_results', 'topics');
please, thanks for your time, bye!

njit
Registered User
Posts: 6
Joined: Mon Jan 24, 2005 2:42 pm

Post by njit » Thu Sep 01, 2005 1:16 pm

Markus,

any hope of releasing a new version in the near future?

Njit

markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux » Thu Sep 01, 2005 2:06 pm

Not in the near future sorry. Too busy at the moment.


.
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)

User avatar
noth
Registered User
Posts: 2472
Joined: Fri Jan 07, 2005 7:10 pm
Location: North Surrey
Contact:

Post by noth » Thu Sep 01, 2005 5:03 pm

demo at [SPAM]

username - bonce
password - 9000

markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux » Thu Sep 01, 2005 5:21 pm

noth, I edited your post. getdaily.php doesn't look related to this MOD. Please, post your MOD elsewhere(*) so people don't get confused.


(*) Open your own thread in the MOD Devel forum or send your MOD to the DB for validation. Thanks
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)

Post Reply

Return to “[2.0.x] MOD Database Releases”