[BETA] Top Poster of the Month 0.3.1 (25 Mar 2007)

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
3Di
Registered User
Posts: 11872
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

[BETA] Top Poster of the Month 0.3.1 (25 Mar 2007)

Post by 3Di » Wed Oct 26, 2005 5:09 am

MOD Title: Top Poster of the Month
MOD Description: Have a Top Poster of the Month to show on your phpBB. Admin not included.
MOD Version: 0.3.1

MOD Download:

Code: Select all

##############################################################
## MOD Title:		Top Poster of the Month
## MOD Author:		3Di < three3di@users.sourceforge.net > (Marco) http://threed.5gbfree.com/ipcf/
## MOD Author:		Dicky < rfoote@tellink.net > (Richard Foote) http://dicky.askmaggymae.com
## MOD Description:	Have a Top Poster of the Month to show on your phpBB. Admin not included.
## MOD Version:		0.3.1
##
## Installation Level:	(Easy)
## Installation Time:	5 minutes
## Files To Edit: 3
##
##			index.php
##			language/lang_english/lang_main.php
##			templates/subSilver/index_body.tpl
##
## Included Files:
##			N/A
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/
##############################################################
## Author Notes:
##
## tested on a fresh phpBB 2.0.22 (localhost)
##
##############################################################
## MOD History:
##
##   2007-03-25 - Version 0.3.1
##   - script tested on a phpBB 2.0.22 in localhost
##   - added INCREMENT action and code ordered
##   - tested with EM 0.3.0
##
##   2005-11-02 - Version 0.3.0 beta
##   - core code partially re written, elapsed time updated in real time (after refresh).
##   - added NoBody fake user in case of no top poster (abandoned board? )
##   - added post/posts language bit
##
##   2005-10-28 - Version 0.1.0 beta
##   - first public release
##
##   2005-10-27 - Version 0.0.1 alpha
##   - first version in localhost
##############################################################
#
#-----[ OPEN ]------------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------------
#
//
// Start page proper
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
// -- Top Poster of the Month add --------------
$today = time();
$date_today = gmdate("Y-m-d", $today);

list($year_cur, $month_cur, $day1) = split('-', $date_today);

$month_start_cur = gmmktime (0,0,0, $month_cur, 1, $year_cur); // Start time for current month
$month_end_cur   = $today;

$month_start = $month_start_cur;
$month_end = $month_end_cur;

$sql = 'SELECT u.username, u.user_regdate, u.user_id, u.user_posts, p.poster_id, p.post_time, COUNT(p.post_id) AS total_posts
	FROM ' . USERS_TABLE . ' u, ' . POSTS_TABLE . ' p
		WHERE (u.user_id <> ' . ANONYMOUS . ')
			AND (u.user_id = p.poster_id)
				AND (u.user_level <> ' . ADMIN . ')
					AND p.post_time BETWEEN ' . $month_start . ' AND ' . $month_end . '
						GROUP BY u.user_id
	ORDER BY total_posts DESC';
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Couldn\'t retrieve Top Poster of the Month\'s data', '', __LINE__, __FILE__, $sql);
	}

// let's go with the loop
$posts_data = $db->sql_fetchrowset($result);
$num_items = count($posts_data);   
$top_posts = $posts_data[0][total_posts]; // The first row will have the most posts since we ordered by total_posts
for ( $row = 0; $row < $num_items; $row++ )
	{
		while ( list( $key, $value ) = each( $posts_data ) )
	{
	if ( $value[total_posts] == $top_posts ) // We have a poster with a match of the top_posts
	{
		$topm_un = $posts_data[0]['username'];
		$topm_rd = $posts_data[0]['user_regdate'];
		$topm_id = $posts_data[0]['user_id'];
		$topm_up = $posts_data[0]['user_posts'];
		$topm_tp = $posts_data[0]['total_posts']; // posts made into the selected elapsed time
         }
      }
   }
if ($topm_tp < 1)
{
	$topm_un = $lang['Top_Username_None'];
}
if ($topm_tp == 1)
{
	$lang['Top_Posts'] = $lang['Top_Post'];
}
// -- Top Poster of the Month end --------------
#
#-----[ FIND ]------------------------------------------------
#
		'FORUM_LOCKED_IMG' => $images['forum_locked'],
#
#-----[ AFTER, ADD ]-----------------------------------------
#
// --- Top Poster of the Month add -------------
		'TOPM_UN' =>sprintf($lang['Top_Username'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$topm_id") . '">', $topm_un, '</a>'),
		'TOPM_RD' => $topm_rd,
		'TOPM_ID' => $topm_id,
		'TOPM_UP' => $topm_up,
// --- Top Poster of the Month end -------------
#
#-----[ FIND ]------------------------------------------------
#
		'L_ONLINE_EXPLAIN' => $lang['Online_explain'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
// --- Top Poster of the Month add -------------
		'L_TOPM_UNA_L' => $lang['Top_Username'],
		'L_TOPM_UID_L' => $lang['Top_User_ID'],
		'L_TOPM_UTP_L' => $lang['Top_User_Posts'],
		'L_TOPM_URD_L' => $lang['Top_User_Registration_date'],
		'L_TOPM_UPO_L' => sprintf($lang['Top_User_Month_Posts'], $topm_tp),
		'L_TOPM_UNN_L' => $lang['Top_Username_None'],
		'L_TOPM_POSTS_L' => $lang['Top_Posts'],
// --- Top Poster of the Month end -------------
#
#-----[ OPEN ]------------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// -- Top Poster of the Month add --------------
$lang['Top_Username'] = 'The Top Poster of the Month till this moment is <b>%s%s%s</b>';
$lang['Top_User_Month_Posts'] = ' with a total of <b>%d</b>';
$lang['Top_Posts'] = ' posts';
$lang['Top_Post'] = ' post';
$lang['Top_Username_None'] = '<b>NoBody</b>';
// --- Top Poster of the Month end -------------
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]------------------------------------------------ 
# The found value can be different, if other mods look for rowspan="2" then
# look for <td class="row1" align="center" valign="middle" rowspan="2"
#
# the line is longer..
#
	<td class="row1" align="center" valign="middle" rowspan="
#
#-----[ IN-LINE FIND ]----------------------------------------
#
rowspan="{%:1}"
#
#-----[ INCREMENT ]-------------------------------- 
#
# add 1 to the preceding value like rowspan="3"
#
%:1 +1
#
#-----[ FIND ]----------------------------------------
# the line is longer...
#
	<td class="row1" align="left" width="100%"><span class="gensmall">{TOTAL_POSTS}
#
#-----[ FIND ]----------------------------------------
#
  </tr>
#
#-----[ AFTER, ADD ]----------------------------------
#
  <tr>
	<td class="row1" align="left"><span class="gensmall">{TOPM_UN}{L_TOPM_UPO_L}{L_TOPM_POSTS_L}</span>
	</td>
  </tr>
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM
Last Stable version:

Demo Board:
Demo Username:
Demo Password:
Last edited by 3Di on Tue Aug 28, 2007 1:14 am, edited 9 times in total.
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

User avatar
3Di
Registered User
Posts: 11872
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

Post by 3Di » Wed Oct 26, 2005 5:09 am

TopPoster_0_3_1.JPG
TopPoster_0_3_1.JPG (48.46 KiB) Viewed 1079 times
Last edited by 3Di on Wed Nov 02, 2005 4:16 pm, edited 2 times in total.
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

User avatar
3Di
Registered User
Posts: 11872
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

Post by 3Di » Fri Oct 28, 2005 7:50 pm

## MOD History:
##
## 2007-03-25 - Version 0.3.1
## - script tested on a phpBB 2.0.22 in localhost
## - added INCREMENT action and code ordered
## - tested with EM 0.3.0
##
## 2005-11-02 - Version 0.3.0 beta
## - core code partially re written, elapsed time updated in real time (after refresh).
## - added NoBody fake user in case of no top poster (abandoned board? )
## - added post/posts language bit
##
## 2005-10-28 - Version 0.1.0 beta
## - first public release
##
## 2005-10-27 - Version 0.0.1 alpha
## - first version in localhost
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

User avatar
dESiLVer
Registered User
Posts: 50
Joined: Wed May 04, 2005 9:26 pm
Location: Turkey
Contact:

Post by dESiLVer » Fri Oct 28, 2005 9:39 pm

looks good :wink: how to integrate username color mod ?

http://www.phpbb.com/phpBB/viewtopic.php?t=187354

User avatar
3Di
Registered User
Posts: 11872
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

Post by 3Di » Fri Oct 28, 2005 9:50 pm

dESiLVer wrote: looks good :wink: how to integrate username color mod ?

Thanks, we're hardly working on the next release of this so i think it is soon for to talk about integrations on other MODs, as a matter of fact i did not integrated this one into my IP Country Flag MOD yet.. ;)

Greets
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

User avatar
k10magic
Registered User
Posts: 314
Joined: Thu Mar 20, 2003 11:38 pm
Location: Canada

Post by k10magic » Fri Oct 28, 2005 11:25 pm

Where does the top poster get displayed? Where on the index?

User avatar
3Di
Registered User
Posts: 11872
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

Post by 3Di » Fri Oct 28, 2005 11:28 pm

3Di wrote: Image
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

User avatar
k10magic
Registered User
Posts: 314
Joined: Thu Mar 20, 2003 11:38 pm
Location: Canada

Post by k10magic » Fri Oct 28, 2005 11:55 pm

Great, adding it now.

(you should add some cool border around the top poster to make it stand out)

User avatar
3Di
Registered User
Posts: 11872
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

Post by 3Di » Sat Oct 29, 2005 12:05 am

k10magic wrote: Great, adding it now.

(you should add some cool border around the top poster to make it stand out)


We'll do.. we're working on the next release (don't worry a changes log will be provided) .. thanks.

:)
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

User avatar
k10magic
Registered User
Posts: 314
Joined: Thu Mar 20, 2003 11:38 pm
Location: Canada

Post by k10magic » Sat Oct 29, 2005 12:09 am

What are you working on adding to the next release?

It would be cool to be able to change in the admin panel if you want to display the top poster of the day, week or month, and maybe even in the future they can earn a special rank/rank image such as "Top Poster" if they have the most posts.

Just an idea.

User avatar
3Di
Registered User
Posts: 11872
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

Post by 3Di » Sat Oct 29, 2005 12:17 am

k10magic wrote: What are you working on adding to the next release?

It would be cool to be able to change in the admin panel if you want to display the top poster of the day, week or month, and maybe even in the future they can earn a special rank/rank image such as "Top Poster" if they have the most posts.

Just an idea.


at the present time fixed the case if not a top poster there is (displays NoBody as the Username) and a language thing IE posts/post in case of 1.. are cases that aren't usually encountered but now covered..

the admin panel thing will be considered, we're working on a selectable drop down menu or such for months not only the last month (in case you want to know who has been the topper of xxx month/year) .. so to make the timestamps entered via menu and not hardcoded..

already considered the rank thing..
greets
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

User avatar
*=Matt=*
Registered User
Posts: 389
Joined: Mon Dec 20, 2004 11:56 pm
Location: Oakdale, Wisconsin

Post by *=Matt=* » Sat Oct 29, 2005 3:14 am

it doesn't work for me

http://www.glitchplay.com/stats/

I have posted 50 some glitches with in two weeks

User avatar
3Di
Registered User
Posts: 11872
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

Post by 3Di » Sat Oct 29, 2005 3:23 am

*=Matt=* wrote: it doesn't work for me

http://www.glitchplay.com/stats/

I have posted 50 some glitches with in two weeks


probably you're the ADMIN, admin it is not included.. you can change the WHERE CLAUSE into the query:

Code: Select all

	WHERE (u.user_id <> ' . ANONYMOUS . ') 
		AND (u.user_id = p.poster_id) 
			AND (u.user_level <> ' . ADMIN . ')
to this

Code: Select all

	WHERE (u.user_id <> ' . ANONYMOUS . ') 
		AND (u.user_id = p.poster_id) 
let me know..
thanks
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

User avatar
*=Matt=*
Registered User
Posts: 389
Joined: Mon Dec 20, 2004 11:56 pm
Location: Oakdale, Wisconsin

Post by *=Matt=* » Sat Oct 29, 2005 4:01 pm

Works now thank you.

User avatar
3Di
Registered User
Posts: 11872
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

Post by 3Di » Sat Oct 29, 2005 4:18 pm

*=Matt=* wrote: Works now thank you.


You're welcome, probably we'll include an option to choice from that admin bit.

greets
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

Post Reply

Return to “[2.0.x] MODs in Development”

Who is online

Users browsing this forum: No registered users and 5 guests

cron