##############################################################
## MOD Title: Topics a user has started
## MOD Author: Manipe < [email protected] > (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.
## MOD Version: 1.5.0
##
## 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
##
##
## Included Files:
## update_to_1.1.3.txt
## update_to_1.2.0.txt
## update_to_1.3.2.txt
## update_to_1.4.0.txt
## update_to_1.5.0.txt
##############################################################
## 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 MODs not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## When you find a AFTER, ADD-Statement, the Code has to be added after the last line quoted in the FIND-Statement.
## When you find a BEFORE, ADD-Statement, the Code has to be added before the last line quoted in the FIND-Statement.
## When you find a IN-LINE BEFORE, ADD-Statement, the Code has to be added before the last bit of code quoted in the IN-LINE FIND-Statement.
##
## If you have installed Version 1.0.0 previously, please use update_to_1.1.3.txt to update to version 1.1.3.
## If you have installed Version 1.1.3 previously, please use update_to_1.2.0.txt to update to version 1.2.0.
## If you have installed Version 1.2.0 previously, please use update_to_1.3.2.txt to update to version 1.3.2.
## If you have installed Version 1.3.2 previously, please use update_to_1.4.0.txt to update to version 1.4.0.
## If you have installed Version 1.4.0 previously, please use update_to_1.5.0.txt to update to the most recent version.
##
##############################################################
## MOD History:
##
##
## 2004-12-05 - Version 1.5.0
## - Now shows the number of topics the user has started in viewtopic.php, just under the avatar, and post total.
##
## 2004-12-04 - Version 1.4.0
## - Now shows the total amount of topics started on the homepage (index.php)
##
## 2004-11-29 - Version 1.3.2
## - Changed the position of the topics started column in the memberlist
##
## 2004-11-27 - Version 1.3.1
## - Forgot to modify the colspan at the bottom of the memberlist
##
## 2004-11-24 - Version 1.3.0
## - Now shows in the memberlist the number of topics the user had started
##
## 2004-11-20 - Version 1.2.0
## - Added statistics, showing the percentage of topics the user posted to the total topics, and the average topics per day.
##
## 2004-11-19 - Version 1.1.3
## - Some more minor mistakes fixed
##
## 2004-11-13 - Version 1.1.2
## - Fixed problem with dangerous retrieving of $user variable
##
## 2004-11-03 - Version 1.1.1
## - Tried to fix problem with dangerous retrieving of $user variable
##
## 2004-10-28 - Version 1.1.0
## - Added function to search for the topics started by the user
##
## 2004-10-23 - Version 1.0.0
## - First version, seems to work fine.
##
##############################################################
## 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 ]------------------------------------------
#
//
// Thats 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="genmedred">[{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 ]------------------------------------------
#
{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 ]------------------------------------------
#
{postrow.POSTER_POSTS}
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<br />{postrow.POSTER_TOPICS}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM