wollte diesen mod
- Code: Alles auswählen
##############################################################
## MOD Title: Email notification when comments on pic
## MOD Author: adidap < invalid@invalid.invalid > (Not given) http://invalid.invalid/
## MOD Description: This will notify the poster of an image if a comment has been posted on his picture. Option to turn it off via the profile.
## MOD Version: 0.0.0
##
## Installation Level: Easy
## Installation Time: 11 minutes
## Files To Edit: includes/usercp_register.php
## language/lang_english/lang_main.php
## album_showpage.php
## templates/subSilver/profile_add_body.tpl
## Included Files:
## License: http://opensource.org/licenses/GPL-license.php GNU General Public License v2
## Generator: Phpbb.ModTeam.Tools
##############################################################
## 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: http://www.adidap.com/projects/email-notification-on-comments-for-smartor-album/
##
## Above link was not working so in order for others to use it I recreated the steps and made it work for FAP as well
##############################################################
## MOD History:
##
## 2007-01-28 - Version 0.0.0
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE phpbb_users ADD user_notify_co TINYINT(1) DEFAULT '1';
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
$notifypm = ( isset($HTTP_POST_VARS['notifypm']) ) ? ( ($HTTP_POST_VARS['notifypm']) ? TRUE : 0 ) : TRUE;
#
#-----[ AFTER, ADD ]------------------------------------------
#
$notifyco = ( isset($HTTP_POST_VARS['notifyco']) ) ? ( ($HTTP_POST_VARS['notifyco']) ? TRUE : 0 ) : TRUE;
#
#-----[ FIND ]------------------------------------------
#
SET " . $username_sql
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_notify_pm = $notifypm
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_notify_co = $notifyco
#
#-----[ FIND ]------------------------------------------
#
$sql = "INSERT INTO " . USERS_TABLE . "
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_notify_pm
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_notify_co
#
#-----[ FIND ]------------------------------------------
#
VALUES ($user_id, '" . str_replace("\'", "''", $username)
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$notifypm
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, $notifyco
#
#-----[ FIND ]------------------------------------------
#
$notifypm = $userdata['user_notify_pm'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$notifyco = $userdata['user_notify_co'];
#
#-----[ FIND ]------------------------------------------
#
display_avatar_gallery($mode
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$notifypm
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, $notifyco
#
#-----[ FIND ]------------------------------------------
#
'NOTIFY_PM_NO' => ( !$notifypm ) ? 'checked="checked"' : '',
#
#-----[ AFTER, ADD ]------------------------------------------
#
'NOTIFY_CO_YES' => ( $notifyco ) ? 'checked="checked"' : '',
'NOTIFY_CO_NO' => ( !$notifyco ) ? 'checked="checked"' : '',
#
#-----[ FIND ]------------------------------------------
#
'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_NOTIFY_ON_COMMENT' => $lang['Notify_on_Comment'],
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
$lang['Notify_on_privmsg'] =
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['Notify_on_Comment'] = 'Notify on new Comment of own Pictures';
#
#-----[ OPEN ]------------------------------------------
#
album_showpage.php
#
#-----[ FIND ]------------------------------------------
#
// --------------------------------
// Complete... now send a message to user
// --------------------------------
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//email the user who received a new comment
$pic = "SELECT * FROM ". ALBUM_TABLE ." WHERE pic_id = $pic_id";
$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path']));
$script_name = ( $script_name != '' ) ? $script_name . '/album_showpage.'.$phpEx : 'album_showpage.'.$phpEx;
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
if ( !($result = $db->sql_query($pic)) )
{
$error = TRUE;
$error_msg = "error";
}
$pic_data = $db->sql_fetchrow($result);
$picuserid = $pic_data['pic_user_id'];
$to = "SELECT * FROM ". USERS_TABLE ." WHERE user_id = '$picuserid'";
if ( !($result = $db->sql_query($to)) )
{
$error = TRUE;
$error_msg = "error";
}
$to_data = $db->sql_fetchrow($result);
if (($comment_user_id != $picuserid) && ($to_data['user_notify_co']))
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->use_template('comment_notify');
$emailer->email_address($to_data['user_email']);
$emailer->assign_vars(array(
'USERNAME' => $to_data['username'],
'C_NAME' => $comment_username,
'PIC_TITLE' => $pic_data['pic_title'],
'Comment_TEXT' => $comment_text,
'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
'U_Comment' => $server_protocol . $server_name . $server_port . $script_name . '?pic_id='. $pic_id)
);
$emailer->send();
$emailer->reset();
}
//email the user who received a new comment
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_add_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_NOTIFY_ON_PRIVMSG}:</span></td>
<td class="row2">
<input type="radio" name="notifypm" value="1" {NOTIFY_PM_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="notifypm" value="0" {NOTIFY_PM_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_NOTIFY_ON_COMMENT}:</span></td>
<td class="row2">
<input type="radio" name="notifyco" value="1" {NOTIFY_CO_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="notifyco" value="0" {NOTIFY_CO_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Then create a file called comment_notify.tpl
and paste this in it
Code: [Download] [Hide] [Select]
Code: [Download] [Show]
Subject: New Comment on your picture: {PIC_TITLE}
Charset: iso-8859-1
Hello {USERNAME},
{C_NAME} has entered the following comment on your picture "{PIC_TITLE}".
--------------------------------------------------
{Comment_TEXT}
--------------------------------------------------
You can view the new comment by clicking on the following link:
{U_Comment}
{EMAIL_SIG}
and save it in language/lang_english/email.
You may wish to include this in the corresponding admin pages too so that an admin can change the settings of users (if necessary) as well rather than going directly into the DB.
NOTE: Please make a backup first in case I missed a line.
einbauen ... allerdings passiert einfach garnichts .... kann die einstellung ändern im profil aber bekomme keine mail ... ?!?! irgend eine idee `?!?
hier meine datein