Kod: Tümünü seç
##############################################################
## MOD Başlığı: Ay'ın Üyesi
## MOD Yazarı: Mirach < mraccik@gmail.com > <burhanabi.com>
## MOD Açıklaması : Ezportallı sistemlerde bugünden başlıyarak ayda bir en çok mesaj yazan üye Ay'ın Üyesi seçilerek blockta gösterilir.
## Yararlanılan MOD : Top Poster of the Month
## Düzenlenecek Dosya Adeti: 3
## portal.php
## languages/xxx/lang_main.php
## templates/xxx/portal_body.tpl
##
##
##############################################################
#
#-----[ AÇ ]------------------------------------------------
#
portal.php
#
#-----[ BUL ]------------------------------------------------
#
//
// Start output of page
//
#
#-----[ ÖNCESİNE EKLE ]-----------------------------------------
#
$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'];
}
#
#-----[ BUL ]------------------------------------------------
#
'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
#
#-----[ SONRASINA EKLE ]-----------------------------------------
#
'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,
#
#-----[ BUL ]-----------------------------------------
#
'L_FORUM' => $lang['Forum'],
#
#-----[ SONRASINA EKLE ]-----------------------------------------
#
'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'],
#
#-----[ AÇ ]------------------------------------------------
#
language/xxx/lang_main.php
#
#-----[ BUL ]------------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------
?>
#
#-----[ ÖNCESINE EKLE ]------------------------------------------
#
,
$lang['Top_Username'] = 'Bu ay en çok mesaj yazan üye: <b>%s%s%s</b>';
$lang['Top_User_Month_Posts'] = ' <b>%d</b>';
$lang['Top_Posts'] = ' mesaj gönderdi.';
$lang['Top_Post'] = ' mesaj gönderdi.';
$lang['Top_Username_None'] = '<b>Yok</b>';
#
#-----[ AÇ ]------------------------------------------------
#
templates/xxx/portal_body.tpl
#
#-----[ TEMAYA EKLE ]------------------------------------------------
#
# Kullanmak istediğiniz yere ekleyin.
#
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" height="25"><span class="genmed"><b>Ay'ın Üyesi</b></span></td>
</tr>
<tr>
<td class="row1" align="left"><span class="gensmall">{TOPM_UN}{L_TOPM_UPO_L}{L_TOPM_POSTS_L}<br /> </span></td>
</tr>
</table>
<br />
#
#-----[ KAYDEDİN VE ÇIKIN ]--------------------------------
#
[ resmi görüntülemek için tıklayın ]
- Mesaj sayı göstergeci eklendi