## EasyMod 0.0.7 compliant
##############################################################
## MOD Title: Mod Post Notification
## MOD Author: netclectic <
adrian@netclectic.com > (Adrian Cockburn)
www.netclectic.com
## MOD Description: Notify forum moderators of any new posts to the forum(s) they are moderator of.
## Includes addition to users profile to let them choose to enable / disable new post notification.
## MOD Version: 1.2.5
##
## Installation Level: moderate
## Installation Time: 40 Minutes
## Files To Edit: (7) posting.php, usercp_register.php, usercp_avatar, profile_add_body.tpl,
## lang_main.php, admin_users.php, user_edit_body.tpl
##
## Included Files: (2) topic_notify_mods.tpl, functions_post_notification.php
##############################################################
## For Security Purposes, Please Check:
http://www.phpbb.com/mods/downloads/ 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/downloads/
##############################################################
## Authors Notes:
##
## Inlcudes db change - 1 new field added to users table.
##
## Version History:
## 1.2.5 - 20030226 - remove admin from notification due to performance hit on larger boards.
## 1.2.4 - 20030223 - use bcc list to improve performance,
## add bad word censor,
## fix to include admin in notification
## 1.2.3 - 20030131 - fixed slight error with missing forum_name parameter
## 1.2.2 - 20030130 - fixed slight error with missing post_id parameter
## 1.2.1 - 20030125 - added DISTINCT in select to fix problem with multiple emails
## 1.2.0 - 20030123 - Updated to work with 2.0.4
## Moved notify code to seperate function
## 1.1.0 - 20030120 - Changed to work with MS ACCESS and MSSQL
## 1.0.9 - 20021103 - Made easymod compliant. Added topic title to subject for topic replies.
## Fixed spelling mistake! Added stripslashes.
## 1.0.8 - 20021002 - Made 'New Forum Post' language specific.
## 1.0.7 - 20020918 - Change to work for both versions 2.0.1 & 2.0.2 and use new template.
## 1.0.6 - 20020902 - Fixed problem with mods receiving notification even if the message
## was not posted due to errors (e.g. missing subject)
## 1.0.5 - 20020803 - Fixed problem with avatar changes resetting the notify setting.
## Added to the user admin section.
## 1.0.4 - 20020731 - Removed AND from sql statement restricting to single users to fix
## problem with moderator groups not getting notification
## 1.0.3 - 20020729 - Fixed even stupider bug!!
## 1.0.2 - 20020726 - Fixed stupid bug & removed any reference to optional bits!.
## 1.0.1 - 20020720 - Fixed problem with non mods.
## 1.0.0 - 20020715 - Original release.
##
## Upgrade Path:
## 1.2.4 -> 1.2.5 - replace functions_post_notification.php
## 1.2.0+ -> 1.2.4 - replace functions_post_notification.php
## replace topic_notify_mods.tpl
## addition to lang_main.php
## $lang['Always_notify_mod_dist_list'] = 'post_notification@%s';
##
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------
#
copy mods/netclectic/functions_post_notification.php to mods/netclectic/
copy language/lang_english/email/topic_notify_mods.tpl to language/lang_english/email/
#
#-----[ SQL ]------------------------------------------
#
# CHANGE TABLE PREFIX ACCORDINGLY!!!
#
# ACCESS USERS
# ALTER TABLE phpbb_users ADD user_notify_mod BYTE NOT NULL;
#
ALTER TABLE phpbb_users ADD user_notify_mod TINYINT(1) NOT NULL;
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT f.*, t.topic_status
#
#-----[ IN-LINE FIND ]----------------------------------
#
t.topic_status
#
#-----[ IN-LINE AFTER, ADD ]----------------------------
#
, t.topic_title
#
#-----[ FIND ]------------------------------------------
#
user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $post_id, $notify_user);
}
#
#-----[ AFTER, ADD ]------------------------------------
#
// MOD NOTIFY MODERATOR BEGIN
if ( ($error_msg == '') && (($mode == 'newtopic') || ($mode == 'reply')) )
{
include_once( $phpbb_root_path . "mods/netclectic/functions_post_notification.$phpEx" );
netclectic_post_notify( $forum_id, $forum_name, $post_id, $message, $subject, $post_info['topic_title'] );
}
// MOD NOTIFY MODERATOR END
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
$popuppm = ( isset($HTTP_POST_VARS['popup_pm']) ) ? ( ($HTTP_POST_VARS['popup_pm']) ? TRUE : 0 ) : TRUE;
#
#-----[ AFTER, ADD ]------------------------------------
#
// MOD NOTIFY MODERATOR BEGIN
$notifymod = ( isset($HTTP_POST_VARS['notifymod']) ) ? ( ($HTTP_POST_VARS['notifymod']) ? TRUE : 0 ) : 0;
// MOD NOTIFY MODERATOR END
#
#-----[ FIND ]------------------------------------------
#
# BEWARE OF OTHER MODS!!!
#
$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . "
#
#-----[ IN-LINE FIND ]----------------------------------
#
$avatar_sql . "
#
#-----[ IN-LINE AFTER, ADD ]----------------------------
#
, user_notify_mod=$notifymod
#
#-----[ FIND ]------------------------------------------
#
$allowviewonline = $userdata['user_allow_viewonline'];
#
#-----[ AFTER, ADD ]------------------------------------
#
// MOD NOTIFY MOD BEGIN
$notifymod = $userdata['user_notify_mod'];
// MOD NOTIFY MOD END
#
#-----[ FIND ]------------------------------------------
#
# BEWARE OF OTHER MODS!!!
#
display_avatar_gallery($mode,
#
#-----[ IN-LINE FIND ]----------------------------------
#
);
#
#-----[ IN-LINE BEFORE, ADD ]---------------------------
#
, $notifymod
#
#-----[ FIND ]------------------------------------------
#
'NOTIFY_REPLY_NO' => ( !$notifyreply ) ? 'checked="checked"' : '',
#
#-----[ AFTER, ADD ]------------------------------------
#
// MOD NOTIFY MOD BEGIN
'NOTIFY_MOD_YES' => ( $notifymod ) ? 'checked="checked"' : '',
'NOTIFY_MOD_NO' => ( !$notifymod ) ? 'checked="checked"' : '',
// MOD NOTIFY MOD END
#
#-----[ FIND ]------------------------------------------
#
'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
);
#
#-----[ AFTER, ADD ]------------------------------------
#
// MOD NOTIFY MOD BEGIN
if ( $userdata['user_level'] == MOD || $userdata['user_level'] == ADMIN )
{
$template->assign_block_vars('switch_notify_mod', array(
'L_NOTIFY_MOD' => $lang['Always_notify_mod'],
'L_NOTIFY_MOD_EXPLAIN' => $lang['Always_notify_mod_explain'],
'NOTIFY_MOD_YES' => ( $notifymod ) ? 'checked="checked"' : '',
'NOTIFY_MOD_NO' => ( !$notifymod ) ? 'checked="checked"' : '',
)
);
}
// MOD NOTIFY MOD END
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_avatar.php
#
#-----[ FIND ]------------------------------------------
#
# BEWARE OF OTHER MODS!!!
#
function display_avatar_gallery($mode,
#
#-----[ IN-LINE FIND ]----------------------------------
#
)
#
#-----[ IN-LINE BEFORE, ADD ]---------------------------
#
, &$notifymod
#
#-----[ FIND ]------------------------------------------
#
# BEWARE OF OTHER MODS!!!
#
$params = array('coppa',
#
#-----[ IN-LINE FIND ]----------------------------------
#
);
#
#-----[ IN-LINE BEFORE, ADD ]---------------------------
#
, 'notifymod'
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_add_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<input type="radio" name="notifyreply" value="0" {NOTIFY_REPLY_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------
#
<!-- BEGIN switch_notify_mod -->
<tr>
<td class="row1"><span class="gen">{switch_notify_mod.L_NOTIFY_MOD}:</span><br />
<span class="gensmall">{switch_notify_mod.L_NOTIFY_MOD_EXPLAIN}</span></td>
<td class="row2">
<input type="radio" name="notifymod" value="1" {switch_notify_mod.NOTIFY_MOD_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="notifymod" value="0" {switch_notify_mod.NOTIFY_MOD_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
<!-- END switch_notify_mod -->
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all, Folks!
#
#-----[ BEFORE, ADD ]-----------------------------------
#
// MOD NOTIFY MODERATOR BEGIN
$lang['Always_notify_mod'] = "Always notify me of new posts to forums I am moderator of";
$lang['Always_notify_mod_explain'] = "Sends an email when someone posts a new topic or replys to a topic in a forum you are moderator of";
$lang['Always_notify_mod_new_forum_post'] = 'New Post - %s';
$lang['Always_notify_mod_dist_list'] = 'post_notification@%s';
// MOD NOTIFY MODERATOR END
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_users.php
#
#-----[ FIND ]------------------------------------------
#
$attachsig = ( isset( $HTTP_POST_VARS['attachsig']) ) ? ( ( $HTTP_POST_VARS['attachsig'] ) ? TRUE : 0 ) : 0;
#
#-----[ AFTER, ADD ]------------------------------------
#
// MOD NOTIFY MODERATOR BEGIN
$notifymod = ( isset($HTTP_POST_VARS['notifymod']) ) ? ( ($HTTP_POST_VARS['notifymod']) ? TRUE : 0 ) : 0;
// MOD NOTIFY MODERATOR END
#
#-----[ FIND ]------------------------------------------
#
# BEWARE OF OTHER MODS!!
#
$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . "
#
#-----[ IN-LINE FIND ]----------------------------------
#
" . $avatar_sql . "
#
#-----[ IN-LINE BEFORE, ADD ]---------------------------
#
, user_notify_mod=$notifymod
#
#-----[ FIND ]------------------------------------------
#
$allowviewonline = $this_userdata['user_allow_viewonline'];
#
#-----[ AFTER, ADD ]------------------------------------
#
// MOD NOTIFY MOD BEGIN
$notifymod = $this_userdata['user_notify_mod'];
// MOD NOTIFY MOD END
#
#-----[ FIND ]------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="signature" value="' . str_replace("\"", """, $signature) . '" />';
#
#-----[ AFTER, ADD ]------------------------------------
#
// MOD NOTIFY MOD BEGIN
$s_hidden_fields .= '<input type="hidden" name="notifymod" value="' . $notifymod . '" />';
// MOD NOTIFY MOD END
#
#-----[ FIND ]------------------------------------------
#
'S_PROFILE_ACTION' => append_sid("admin_users.$phpEx"))
);
#
#-----[ AFTER, ADD ]------------------------------------
#
// MOD NOTIFY MOD BEGIN
if ( $this_userdata['user_level'] == MOD || $this_userdata['user_level'] == ADMIN )
{
$template->assign_block_vars('switch_notify_mod', array(
'L_NOTIFY_MOD' => $lang['Always_notify_mod'],
'NOTIFY_MOD_YES' => ( $notifymod ) ? 'checked="checked"' : '',
'NOTIFY_MOD_NO' => ( !$notifymod ) ? 'checked="checked"' : '',
)
);
}
// MOD NOTIFY MOD END
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/user_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<input type="radio" name="notifyreply" value="0" {NOTIFY_REPLY_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------
#
<!-- BEGIN switch_notify_mod -->
<tr>
<td class="row1"><span class="gen">{switch_notify_mod.L_NOTIFY_MOD}:</span></td>
<td class="row2">
<input type="radio" name="notifymod" value="1" {switch_notify_mod.NOTIFY_MOD_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="notifymod" value="0" {switch_notify_mod.NOTIFY_MOD_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
<!-- END switch_notify_mod -->
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#
# EoM