Code: Alles auswählen
##############################################################
## MOD Title: Most Active Forum MOD
## MOD Author: kratzer54847 < alternativ3322@web.de > (Johny Jesewski)
## MOD Description: Displays the user's most active forum in his profile
## MOD Version: 0.0.2
##
## Installation Level: Easy
## Installation Time: 1 Minutes
## Files To Edit: includes/usercp_viewprofile.php,
## templates/subSilver/profile_view_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/mods/
##############################################################
## Author Notes:
##
##############################################################
## MOD History:
##
## 2006-07-08 - Version 0.0.2
## - using of the phpBB authentication system to prevent hidden fora from being shown
## - forgot some lang variables
##
## 2006-07-08 - Version 0.0.1
## - first alpha version
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
else
{
$percentage = 0;
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// The users most active forum
//
//
// Select the user's posts per forum
//
$sql = 'SELECT f.forum_id, f.forum_name, f.forum_posts, COUNT(p.post_id) AS posts
FROM phpbb_forums AS f, phpbb_posts AS p
WHERE p.forum_id = f.forum_id
AND p.poster_id = ' . $profiledata['user_id'] . '
GROUP BY f.forum_id
ORDER BY posts DESC
LIMIT 1';
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
$forum_posts = $row['posts'];
$forum_id = $row['forum_id'];
//
// Find which forums are visible for this user
//
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);
$read = $is_auth_ary[$forum_id]['auth_view'];
if ( $read == '1' )
{
$sql = "SELECT forum_posts
FROM " . FORUMS_TABLE . "
WHERE forum_id = " . $row['forum_id'];
$result = $db->sql_query($sql);
if ( $rowsub = $db->sql_fetchrow($result) )
{
$all_posts = $rowsub['forum_posts'];
//
// Calculate percentage
//
$all_posts_percentage = $forum_posts / $all_posts * 100;
$all_posts_percentage = round($all_posts_percentage, 2);
$all_posts_percentage = $all_posts_percentage . '% ' . $lang['Oap'];
$most_active_forum = "<a href='" . append_sid("viewforum.php?f=" . $row['forum_id']) . "' class'genmed'>" . $row['forum_name'] . "</a>";
$most_active_desc = $most_active_forum . '<br/>' . '[' . $forum_posts . ' ' . $lang['Posts'] . ' ' . 'of' . ' ' . $all_posts . ' ' . $lang['Posts'] . ' ' . '(' . ' ' . $all_posts_percentage . ')]';
}
}
else
{
$most_active_desc = $lang['No_posts'];
$all_posts_percentage = '';
}
}
else
{
$most_active_desc = $lang['No_posts'];
}
#
#-----[ FIND ]------------------------------------------
#
'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage),
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_MOST_ACTIVE' => $lang['Most_active_forum'],
'MOST_ACTIVE_DESC' => $most_active_desc,
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['Most_active_forum'] = 'Most active forum';
$lang['No_posts'] = 'No Posts';
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_TOTAL_POSTS}: </span></td>
<td valign="top"><b><span class="gen">{POSTS}</span></b><br /><span class="genmed">[{POST_PERCENT_STATS} / {POST_DAY_STATS}]</span> <br /><span class="genmed"><a href="{U_SEARCH_USER}" class="genmed">{L_SEARCH_USER_POSTS}</a></span></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_MOST_ACTIVE}: </span></td>
<td width="100%"><span class="genmed"><b>{MOST_ACTIVE_DESC}</b></span></td>
</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EOM
