Kod: Tümünü seç
##############################################################
## MOD Title: PM Count MOD
## MOD Author: ErDrRon < ErDrRon@aol.com > (N/A) http://www.ErDrRon.com
## MOD Description: Allows administrators and moderators to view the total number of PMs sent
## by users in their profile as well as on the Memberlist.
## This version has been tested and works with phpBB 2.0.22.
## MOD Version: 1.1.1
##
## Installation Level: Easy
## Installation Time: 7 minutes
##
## Files To Edit: memberlist.php
## privmsg.php
## includes/usercp_viewprofile.php
## language/lang_english/lang_main.php
## templates/subsilver/memberlist_body.tpl
## templates/subsilver/profile_view_body.tpl
##
## Included Files: db_install.php
##
## 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:
##
## This MOD shows the total number of PMs a user has sent on their profile page as
## well as on the Memberlist. Only Admins and Mods can view this new field. The number
## of PMs sent for every user will start at zero once this MOD is installed and will increment
## by one each time they send a PM afterwards. There is no way to know how many PMs were sent
## prior to installation of this MOD as phpBB did not previously store that information.
##
## I have included a set of pre-edited files in the contrib folder. You can copy these
## pre-edited files directly to your server replacing the original phpBB files ONLY if you
## have not modified the standard phpBB installation in any way. If you have already modified
## any of the files in your current phpBB installation that will be replaced by the
## pre-edited files in this MOD you may break your forum and it may no longer function
## correctly.
##
## I have also included an Add-on to view the number of PM's sent by each user to the
## Admin Userlist MOD. http://www.phpbb.com/community/viewtopic.php?f=15&t=117359
##
## While this version has only been tested and certified to work with phpBB version 2.0.22 it
## likely will work with any phpBB 2.0.x version. If you need me to test it for a particular
## version please let me know.
##
## Please note that this MOD is NOT written to be EasyMod compatible (I haven't tested it).
##
## This MOD was written at the request of sibry at:
## http://www.phpbb.com/community/viewtopic.php?f=17&t=540895&start=0&st=0&sk=t&sd=a
##
##############################################################
##
## MOD History:
##
## 2007-05-17 - Version 1.1.1
## - added Admin Userlist Add-on
##
## 2007-05-16 - Version 1.1.0
## - added total PMs count to Memberlist
##
## 2007-05-15 - Version 1.0.0
## - initial stable release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]--------------------------------------------
#
copy db_install.php to db_install.php
#
#-----[ DIY INSTRUCTIONS ]--------------------------------
#
Installing the database changes:
Only run the db_install.php script if this is a first-time installation
of the PM Count MOD AND you are using mySQL for your database.
DO NOT upload or run this script if you have already installed the database changes with a
prior version of the PM Count MOD. IF this is a new installation of the MOD then:
Upload db_install.php to your root phpBB directory.
Open a new browser window and run the script; a typical address might be:
http://www.your.domain.name.com/phpbb/db_install.php
** For security purposes, once you've had a successful install delete the
db_install.php script immediately.
For those that wish to install the database changes manually and not use db_install.php
the SQL query is:
ALTER TABLE phpbb_users ADD user_pms MEDIUMINT(8) UNSIGNED DEFAULT '0' NOT NULL AFTER user_posts;
** This query assumes the default database table prefix of phpbb_. You will need to change this if
you have chosen a different prefix for your database tables.
#
#-----[ OPEN ]--------------------------------------------
#
memberlist.php
#-----[ FIND ]--------------------------------------------
#
# approximately line 110
#
'L_POSTS' => $lang['Posts'],
#
#-----[ AFTER, ADD ]--------------------------------------
#
// PM Count MOD - Begin
'L_PMS' => $lang['Pms'],
// PM Count MOD - End
#-----[ FIND ]--------------------------------------------
#
# approximately line 168
#
$posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;
#
#-----[ AFTER, ADD ]--------------------------------------
#
// PM Count MOD - Begin
$total_pms = ( $row['user_pms'] ) ? $row['user_pms'] : 0;
// PM Count MOD - End
#-----[ FIND ]--------------------------------------------
#
# approximately line 251
#
'POSTS' => $posts,
#
#-----[ AFTER, ADD ]--------------------------------------
#
// PM Count MOD - Begin
'TOTAL_PMS' => $total_pms,
// PM Count MOD - End
#-----[ FIND ]--------------------------------------------
#
# approximately line 276
#
# After the closing );
#
'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"))
);
#
#-----[ AFTER, ADD ]--------------------------------------
#
// PM Count MOD - Begin
if ($userdata['user_level'] == 1 || $userdata['user_level'] == 2 )
{
$template->assign_block_vars('memberrow.switch_admin_mod_yes', array());
}
// PM Count MOD - End
#-----[ FIND ]--------------------------------------------
#
# approximately line 321
#
# After the closing );
#
'L_GOTO_PAGE' => $lang['Goto_page'])
);
#
#-----[ AFTER, ADD ]--------------------------------------
#
// PM Count MOD - Begin
if ($userdata['user_level'] == 1 || $userdata['user_level'] == 2 )
{
$template->assign_block_vars('switch_admin_mod_yes', array());
}
// PM Count MOD - End
#
#-----[ OPEN ]--------------------------------------------
#
privmsg.php
#
#-----[ FIND ]--------------------------------------------
#
# approximately line 1334
#
message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql);
}
#
#-----[ AFTER, ADD ]--------------------------------------
#
# After the closing }
#
// PM Count MOD - Begin
//
// Add to senders pm counter
//
$sql = "UPDATE " . USERS_TABLE . "
SET user_pms = user_pms + 1
WHERE user_id = " . $userdata['user_id'];
if ( !$status = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update private message counter for sender', '', __LINE__, __FILE__, $sql);
}
// PM Count MOD - End
#
#-----[ OPEN ]--------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]--------------------------------------------
#
# approximately line 195
#
'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage),
#
#-----[ AFTER, ADD ]--------------------------------------
#
// PM Count MOD - Begin
'PMS' => $profiledata['user_pms'],
// PM Count MOD - End
#
#-----[ FIND ]--------------------------------------------
#
# approximately line 229
#
'L_SEARCH_USER_POSTS' => sprintf($lang['Search_user_posts'], $profiledata['username']),
#
#-----[ AFTER, ADD ]--------------------------------------
#
// PM Count MOD - Begin
'L_TOTAL_PMS' => $lang['Total_pms'],
// PM Count MOD - End
#
#-----[ FIND ]--------------------------------------------
#
# approximately line 248
#
'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
);
#
#-----[ AFTER, ADD ]--------------------------------------
#
# After the closing );
#
// PM Count MOD - Begin
if ($userdata['user_level'] == 1 || $userdata['user_level'] == 2 )
{
$template->assign_block_vars('switch_admin_mod_yes', array());
}
// PM Count MOD - End
#
#-----[ OPEN ]--------------------------------------------
#
# You need to make this edit to any additional languages you have installed as well
#
language/lang_english/lang_main.php
#
#-----[ FIND ]--------------------------------------------
#
# approximately line 537
#
$lang['Search_user_posts'] = 'Find all posts by %s'; // Find all posts by username
#
#-----[ AFTER, ADD ]--------------------------------------
#
// PM Count MOD - Begin
$lang['Total_pms'] = 'Total PMs';
$lang['Pms'] = 'PMs';
// PM Count MOD - End
#
#-----[ OPEN ]--------------------------------------------
#
# You need to make this edit to any additional templates you have installed as well
#
templates/subsilver/memberlist_body.tpl
#
#-----[ FIND ]--------------------------------------------
#
# approximately line 19
#
<th class="thTop" nowrap="nowrap">{L_POSTS}</th>
#
#-----[ AFTER, ADD ]--------------------------------------
#
<!-- PM Count MOD - Start -->
<!-- BEGIN switch_admin_mod_yes -->
<th class="thTop" nowrap="nowrap">{L_PMS}</th>
<!-- END switch_admin_mod_yes -->
<!-- PM Count MOD - End -->
#
#-----[ FIND ]--------------------------------------------
#
# approximately line 35
#
<td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.POSTS}</span></td>
#
#-----[ AFTER, ADD ]--------------------------------------
#
<!-- PM Count MOD - Start -->
<!-- BEGIN switch_admin_mod_yes -->
<td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.TOTAL_PMS}</span></td>
<!-- END switch_admin_mod_yes -->
<!-- PM Count MOD - End -->
#
#-----[ FIND ]--------------------------------------------
#
# approximately line 45
#
<td class="catBottom" colspan="8" height="28"> </td>
#
#-----[ REPLACE WITH ]------------------------------------
#
# the goal is to increment the colspan by 1; if it is 8 make it 9, etc.
#
<!-- PM Count MOD - Start -->
<td class="catBottom" colspan="9" height="28"> </td>
<!-- PM Count MOD - End -->
#
#-----[ OPEN ]--------------------------------------------
#
# You need to make this edit to any additional templates you have installed as well
#
templates/subsilver/profile_view_body.tpl
#
#-----[ FIND ]--------------------------------------------
#
# approximately line 25
#
<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 ]--------------------------------------
#
<!-- PM Count MOD - Begin -->
<!-- BEGIN switch_admin_mod_yes -->
<tr>
<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_TOTAL_PMS}: </span></td>
<td><b><span class="gen">{PMS}</span></b></td>
</tr>
<!-- END switch_admin_mod_yes -->
<!-- PM Count MOD - End -->
#
#-----[ SAVE/CLOSE ALL FILES ]----------------------------
#
# EoM