Не вручную же считать... возможно есть таокй мод.. если кто видел дайте ссылку..

Код: Выделить всё
##############################################################
## MOD Title: Topics a user has started
## MOD Author: Manipe < admin@manipef1.com > (N/A) http://www.manipef1.com
## MOD Description: Shows the number of topics a user has started in the profile page just under total posts and also enables you to search for the topics that that user started. Additionally, it displays statistics about the number of topics, and also displays the number of topics that user started in the Memberlist and in the viewtopic page under the avatar and total posts.
## MOD Version: 1.5.2
##
## Installation Level: Easy
## Installation Time: ~ 10 Minutes
## Files To Edit:
## includes/usercp_viewprofile.php
## language/lang_english/lang_main.php
## templates/subSilver/profile_view_body.tpl
## search.php
## memberlist.php
## templates/subSilver/memberlist_body.tpl
## index.php
## templates/subSilver/index_body.tpl
## viewtopic.php
## templates/subSilver/viewtopic_body.tpl
##############################################################
## 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/
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
$search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Topics a user has started MOD, By Manipe (Begin)
$sql = "SELECT COUNT(*) as topic_count FROM " . TOPICS_TABLE . " WHERE topic_poster = '" . $profiledata['user_id'] . "'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topics started information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$topics_started = ( $row['topic_count'] ) ? $row['topic_count'] : 0;
$db->sql_freeresult($result);
$sql = "SELECT COUNT(*) as total_topic_count FROM " . TOPICS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topics started information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$total_topics = ( $row['total_topic_count'] ) ? $row['total_topic_count'] : 0;
$topics_percentage = ( $total_topics ) ? min(100, ($topics_started / $total_topics) * 100) : 0;
$topics_per_day = $topics_started / $memberdays;
$db->sql_freeresult($result);
// Topics a user has started MOD, By Manipe (End)
#
#-----[ FIND ]------------------------------------------
#
'YIM_IMG' => $yim_img,
'YIM' => $yim,
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Topics a user has started MOD, By Manipe (Begin)
'TOPICS_STARTED' => $topics_started,
'L_TOPICS_STARTED' => $lang['Topics_Started'],
'L_SEARCH_USER_TOPICS' => sprintf($lang['Search_user_topics'], $profiledata['username']),
'U_SEARCH_USER_TOPICS' => append_sid("search.$phpEx?search_id=usertopics&user=" . urlencode($profiledata['user_id'])),
'TOPIC_DAY_STATS' => sprintf($lang['User_topic_day_stats'], $topics_per_day),
'TOPIC_PERCENT_STATS' => sprintf($lang['User_topic_pct_stats'], $topics_percentage),
// Topics a user has started MOD, By Manipe (End)
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all, Folks!
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Topics a user has started MOD, By Manipe (Begin)
$lang['Topics_Started'] = 'Topics started';
$lang['Search_user_topics'] = 'Find all topics started by %s'; // Find all topics started by username
$lang['User_topic_pct_stats'] = '%.2f%% of total'; // 1.25% of total
$lang['User_topic_day_stats'] = '%.2f topics per day'; // 1.5 topics per day
$lang['Memberlist_topics_started'] = 'Topics';
$lang['Total_topics_started_index'] = ' in <b>%d</b> topics';
$lang['Topics_viewtopic'] = 'Topics';
// Topics a user has started MOD, By Manipe (End)
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_LOCATION}: </span></td>
<td><b><span class="gen">{LOCATION}</span></b></td>
</tr>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<tr>
<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_TOPICS_STARTED}: </span></td>
<td><b><span class="gen">{TOPICS_STARTED}</span></b><br /><span class="genmed">[{TOPIC_PERCENT_STATS} / {TOPIC_DAY_STATS}]</span> <br /><span class="genmed"><a href="{U_SEARCH_USER_TOPICS}" class="genmed">{L_SEARCH_USER_TOPICS}</a></span></td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
search.php
#
#-----[ FIND ]------------------------------------------
#
#Note: full line is longer
if ( $search_id == 'newposts' || $search_id == 'egosearch' || $search_id == 'unanswered'
#
#-----[ IN-LINE FIND ]------------------------------------------
#
)
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
|| $search_id == 'usertopics'
#
#-----[ FIND ]------------------------------------------
#
#Note: full line is longer
if ( $search_id == 'newposts' || $search_id == 'egosearch'
#
#-----[ IN-LINE FIND ]------------------------------------------
#
( $search_author !=
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
$search_id == 'usertopics' ||
#
#-----[ FIND ]------------------------------------------
#
else
{
redirect(append_sid("login.$phpEx?redirect=search.$phpEx&search_id=newposts", true));
}
$show_results = 'topics';
$sort_by = 0;
$sort_dir = 'DESC';
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Topics a user has started MOD, By Manipe (Begin)
else if ( $search_id == 'usertopics' )
{
$user = ( !empty($HTTP_GET_VARS['user']) ) ? intval($HTTP_GET_VARS['user']) : '0';
$sql = "SELECT p.post_id
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
WHERE t.topic_poster = " . $user . " AND
p.post_id = t.topic_first_post_id";
$show_results = 'topics';
$sort_by = 0;
$sort_dir = 'DESC';
}
// Topics a user has started MOD, By Manipe (End)
#
#-----[ OPEN ]------------------------------------------
#
memberlist.php
#
#-----[ FIND ]------------------------------------------
#
'L_PM' => $lang['Private_Message'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Topics a user has started MOD, By Manipe (Begin)
'L_TOPICS' => $lang['Memberlist_topics_started'],
// Topics a user has started MOD, By Manipe (End)
#
#-----[ FIND ]------------------------------------------
#
$search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Topics a user has started MOD, By Manipe (Begin)
$sql2 = "SELECT COUNT(*) as topic_count FROM " . TOPICS_TABLE . " WHERE topic_poster = '" . $user_id . "'";
if ( !($result2 = $db->sql_query($sql2)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topics started information', '', __LINE__, __FILE__, $sql);
}
$row2 = $db->sql_fetchrow($result2);
$topics_started = ( $row2['topic_count'] ) ? $row2['topic_count'] : 0;
$db->sql_freeresult($result2);
// Topics a user has started MOD, By Manipe (End)
#
#-----[ FIND ]------------------------------------------
#
'YIM' => $yim,
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Topics a user has started MOD, By Manipe (Begin)
'TOPICS_STARTED' => $topics_started,
// Topics a user has started MOD, By Manipe (End)
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/memberlist_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<th class="thTop" nowrap="nowrap">{L_POSTS}</th>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<th class="thTop" nowrap="nowrap">{L_TOPICS}</th>
#
#-----[ FIND ]------------------------------------------
#
<td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.POSTS}</span></td>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.TOPICS_STARTED}</span></td>
#
#-----[ FIND ]------------------------------------------
#
<td class="catBottom" colspan="8" height="28"> </td>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<td class="catBottom" colspan="9" height="28"> </td>
#
#-----[ OPEN ]------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------
#
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Topics a user has started MOD, by Manipe (Begin)
$sql = "SELECT COUNT(*) as topic_count FROM " . TOPICS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topics started information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$total_topics = ( $row['topic_count'] ) ? $row['topic_count'] : 0;
$db->sql_freeresult($result);
// Topics a user has started MOD, by Manipe (End)
#
#-----[ FIND ]------------------------------------------
#
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Topics a user has started MOD, By Manipe (Begin)
'TOTAL_TOPICS' => sprintf($lang['Total_topics_started_index'], $total_topics),
// Topics a user has started MOD, By Manipe (End)
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]------------------------------------------
#Note: full line is longer
<td class="row1" align="left" width="100%"><span class="gensmall">{TOTAL_POSTS}<br />
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{TOTAL_POSTS}
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
{TOTAL_TOPICS}
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
if ( $poster_id != ANONYMOUS )
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Topics a user has started MOD, By Manipe (Begin)
$sql1 = "SELECT COUNT(*) AS topic_count FROM " . TOPICS_TABLE . " WHERE topic_poster = '" . $postrow[$i]['user_id'] . "'";
if ( !($result1 = $db->sql_query($sql1)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topics started information', '', __LINE__, __FILE__, $sql);
}
$row1 = $db->sql_fetchrow($result1);
$topics_started = $lang['Topics_viewtopic'] . ': ' . (( $row1['topic_count'] ) ? $row1['topic_count'] : 0);
$db->sql_freeresult($result1);
// Topics a user has started MOD, By Manipe (End)
#
#-----[ FIND ]------------------------------------------
#
$yim = '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Topics a user has started MOD, By Manipe (Begin)
$topics_started = '';
// Topics a user has started MOD, By Manipe (End)
#
#-----[ FIND ]------------------------------------------
#
'POSTER_POSTS' => $poster_posts,
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Topics a user has started MOD, By Manipe (Begin)
'POSTER_TOPICS' => $topics_started,
// Topics a user has started MOD, By Manipe (End)
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
#Note: full line is longer
<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}">
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{postrow.POSTER_POSTS}
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<br />{postrow.POSTER_TOPICS}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Наши пользователи оставили сообщений: 13474 в 711 темах
Всего зарегистрированных пользователей: 341
Последний зарегистрированный пользователь: Копрофаг
Больше всего сообщений у [%user name%]
Больше всего тем создал [%user name%]