|
|
It appears you are using a browser that is not based on Internet Explorer, this means you are not viewing the web as good as you should be. Other browsers might try to immitate Internet Explorer, but none can parse the web as it should like Internet Explorer can. So view the web as it was meant to be with Avant Browser!
|
| |
|
|
All times are GMT - 5 Hours
|
|
 |
Thu Jan 26, 2006 7:53 pm |
 |
Author |
Message |
DragonMaster  Site Supporter

Joined: 11 Jan 2005 Posts: 373 Words Posted: 36,703 Average Post: 98.40 Location: USA
|
| Post subject: Poster of the month and AUC |
|
|
I have the top poster mod now working perfectly with AUC added to it.
Now I have integrated Top Poster of The Month with this and all is showing as a basic white sentence including the top poster.
Is it possible to add AUC to this to get color to the user name?
here is the code:
| Code: | ##############################################################
## MOD Title: Top Poster of the Month
## MOD Author: 3Di < 3D@you3d.za.net > (Marco) http://www.phpbb2italia.za.net/phpbb2/index.php
## 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.0
##
## Installation Level: (Easy)
## Installation Time: 5 minutes
## Files To Edit:
##
## 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.18 (localhost)
##
##############################################################
## MOD History:
##
## 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 line is longer..
<td class="row1" align="center" valign="middle" rowspan="2">
#
#-----[ IN-LINE FIND ]----------------------------------------
#
rowspan="2"
#
#-----[ IN-LINE REPLACE WITH ]--------------------------------
#
rowspan="3"
#
#-----[ 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 |
|
|
| Post #1 |
|
|
 |
Thu Jan 26, 2006 11:06 pm |
 |
Author |
Message |
aUsTiN Webmaster


Joined: 05 Jan 2005 Posts: 3684 Words Posted: 144,671 Average Post: 39.27 Location: USA
|
| Post subject: |
|
|
With it being only 2 edits, i figured it would be easy for people to do....
u.user_posts,
AFTER ADD
u.user_color_gc
$topm_un = $posts_data[0]['username'];
REPLACE WITH
the checkusernamecolor() function line, you can look at the top posters you just did for the format as i dont remember it by heart.... |
|
| Post #2 |
|
|
 |
Fri Jan 27, 2006 2:50 pm |
 |
Author |
Message |
DragonMaster  Site Supporter

Joined: 11 Jan 2005 Posts: 373 Words Posted: 36,703 Average Post: 98.40 Location: USA
|
| Post subject: |
|
|
When I try to add the function line, I keep getting errors or else the top poster name disappears altogether.
Here is that code you didn't recall.....could you make it right for me please?
| Code: |
// Begin Top Posters on Index
if ($board_config['top_posters'])
{
$top_posters = $board_config['top_posters'];
$sql = "SELECT username, user_id, user_color_gc, user_level, user_posts
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
ORDER BY user_posts DESC LIMIT $top_posters";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}
$user_count = $db->sql_numrows($result);
$user_data = $db->sql_fetchrowset($result);
$firstcount = $user_data[0]['user_posts'];
$total_posts = get_db_stat('postcount');
$total_top_posters = 0;
$top_posters_userlist = '';
$seperator = ', ';
for ($i = 0; $i < $user_count; $i++)
{
if ($user_data[$i]['user_color_gc'])
{
$user_data[$i]['username'] = CheckUsernameColor($user_data[$i]['user_color_gc'], $user_data[$i]['username']);
}
else if ($user_data[$i]['user_level'] == ADMIN)
{
$user_data[$i]['username'] = '<b><span style="color:#'. $theme['fontcolor3'] .'">'. $user_data[$i]['username'] .'</span></b>';
}
else if ($user_data[$i]['user_level'] == MOD)
{
$user_data[$i]['username'] = '<b><span style="color:#'. $theme['fontcolor2'] .'">'. $user_data[$i]['username'] .'</span></b>';
}
else
{
$user_data[$i]['username'] = '<b><span style="color:#'. $theme['fontcolor1'] .'">'. $user_data[$i]['username'] .'</span></b>';
}
$top_posters_userlist .= (( ($top_posters_userlist) && ($user_data[$i]['user_id']) ) ? $seperator : '') .'<a alt="'. $alt .'" title="'. $alt .'" href="profile.'. $phpEx .'?mode=viewprofile&u='. $user_data[$i]['user_id'] .'" class="copyright">'. $user_data[$i]['username'] .'</a>('. $user_data[$i]['user_posts'] .')';
$total_top_posters++;
}
}
// End Top Posters on Index |
|
|
| Post #3 |
|
|
 |
Fri Jan 27, 2006 4:37 pm |
 |
 |
Fri Jan 27, 2006 7:50 pm |
 |
 |
Fri Jan 27, 2006 8:43 pm |
 |
Author |
Message |
DragonMaster  Site Supporter

Joined: 11 Jan 2005 Posts: 373 Words Posted: 36,703 Average Post: 98.40 Location: USA
|
| Post subject: |
|
|
| Spinebuster wrote: | | Code: | | $topm_un = CheckUsernameColor( $posts_data[0]['username']); |
Maybe...  |
No....that gave me:
Warning: Missing argument 2 for checkusernamecolor() in /home/ronnieja/public_html/test-1dio/includes/functions.php on line 1356
Warning: Cannot modify header information - headers already sent by (output started at /home/ronnieja/public_html/test-1dio/includes/functions.php:1356) in /home/ronnieja/public_html/test-1dio/includes/page_header.php on line 813
Warning: Cannot modify header information - headers already sent by (output started at /home/ronnieja/public_html/test-1dio/includes/functions.php:1356) in /home/ronnieja/public_html/test-1dio/includes/page_header.php on line 815
Warning: Cannot modify header information - headers already sent by (output started at /home/ronnieja/public_html/test-1dio/includes/functions.php:1356) in /home/ronnieja/public_html/test-1dio/includes/page_header.php on line 816
Lines 813-816:
header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
}
header ('Expires: 0');
header ('Pragma: no-cache');
functions 1356:
function CheckUsernameColor($color, $username) |
|
| Post #6 |
|
|
 |
Fri Jan 27, 2006 8:59 pm |
 |
 |
Fri Jan 27, 2006 9:28 pm |
 |
 |
Fri Jan 27, 2006 10:12 pm |
 |
Author |
Message |
Spinebuster Support Team

Joined: 21 Jan 2005 Posts: 413 Words Posted: 25,498 Average Post: 61.74
|
| Post subject: |
|
|
Try this out.
| Code: | if ( $value[total_posts] == $top_posts ) // We have a poster with a match of the top_posts
{
if ($posts_data[0]['user_color_gc'])
{
$topm_un = CheckUsernameColor($posts_data[0]['user_color_gc'], $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
} |
|
|
| Post #9 |
|
|
 |
Sat Jan 28, 2006 1:46 am |
 |
Author |
Message |
DragonMaster  Site Supporter

Joined: 11 Jan 2005 Posts: 373 Words Posted: 36,703 Average Post: 98.40 Location: USA
|
| Post subject: |
|
|
Parse error: parse error, unexpected T_STRING in /home/ronnieja/public_html/test-1dio/index.php on line 634
| Code: |
Parse error: parse error, unexpected T_STRING in /home/ronnieja/public_html/test-1dio/index.php on line 634
630 {
631 while ( list( $key, $value ) = each( $posts_data ) )
632 {
633 if ( $value[total_posts] == $top_posts ) // We have a poster with a match of the top_posts
634 {
635 if ($posts_data[0]['user_color_gc'])
636 {
637 $topm_un = CheckUsernameColor($posts_data[0]['user_color_gc'], $posts_data[0]['username']);
638 }
639 $topm_rd = $posts_data[0]['user_regdate'];
640 $topm_id = $posts_data[0]['user_id']; |
|
|
| Post #10 |
|
|
 |
Sat Jan 28, 2006 10:45 am |
 |
 |
Sat Jan 28, 2006 10:50 am |
 |
 |
Sat Jan 28, 2006 11:37 am |
 |
Author |
Message |
Spinebuster Support Team

Joined: 21 Jan 2005 Posts: 413 Words Posted: 25,498 Average Post: 61.74
|
| Post subject: |
|
|
| Well, you shouldnt be getting parse errors like you are, if anything it just wont display the text properly. All the code that has been posted has proper syntax. Make sure all your settings are right in your editor. |
|
| Post #13 |
|
|
 |
Wed Feb 15, 2006 12:39 am |
 |
 |
Fri Feb 17, 2006 7:27 pm |
 |
Author |
Message |
Spinebuster Support Team

Joined: 21 Jan 2005 Posts: 413 Words Posted: 25,498 Average Post: 61.74
|
| Post subject: |
|
|
Open Index.php
Find:
| Code: | // -- 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 --------------
|
Replace with:
| Code: | // -- 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_color_gc, 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_un = CheckUsernameColor($posts_data[0]['user_color_gc'], $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 -------------- |
Tested and it works. If you get errors then you either inserted the code wrong or your text editor is junk. |
|
| Post #15 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
Protected by phpBB Security © phpBB-TweakS phpBB Security Has Blocked 3,237 Exploit Attempts.
· Archive · Sitemap: Index · Sitemap: Forums · Sitemap: Topics · Sitemap: Posts ·
:: [ Load Time: 2.9 Seconds ] :: [ 29 Queries ] :: [ 3,688 Page(s) Viewed Today ] :: :: [ Todays Queries: 103,298 ] :: [ Highest Load: 1,396,429 Queries On May. 08, 2007 ] :: :: [ SQL Load: 59% Time: 1.7 ] :: [ PHP Load: 41% Time: 1.2 ] :: [ Debug: On ] :: [ GZIP: Enabled ] :: :: The server last rebooted 80 days, 2 hours, 31 minutes, 11 seconds ago. ::
|
|
|