Ahora tocamos un fichero crucial... el que manda los mensajes a los usuarios suscritos a un tema:
includes/functions_post.php
Adjuntaremos al final este fichero modificado para mas comodidad del webmaster.
######### --- includes/functions_post.php ----
#########
---------- Add this line at the end of function "function user_notification" --- line 432
Quote::
user_forum_notification($mode, $post_data, $topic_title, $forum_id, $topic_id, $post_id, $notify_user);
----------- Create new function --------
Creamos una nueva Funcion:
Quote::
function user_forum_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user)
{
global $board_config, $lang, $db, $phpbb_root_path, $MAIN_CFG;
global $userdata;
$current_time = gmtime();
////// mio - Observar Foro - Forum Watch //////
if(!$topic_title || $topic_title == "" ){
$row = $db->sql_fetchrow( $db->sql_query('SELECT topic_title FROM '.TOPICS_TABLE.' WHERE topic_id ='.$topic_id ));
$topic_title = $row['topic_title'];
}
if ($mode == 'reply' || $mode == 'newtopic' ) {
$result = $db->sql_query('SELECT user_id FROM '.USERS_TABLE.' WHERE user_level<1');
$user_id_sql = '';
while ($row = $db->sql_fetchrow($result)) { $user_id_sql .= ', '.$row['user_id']; }
$sql = "SELECT u.user_id, u.user_email, u.user_lang
FROM ".FORUMS_WATCH_TABLE." tw, ".USERS_TABLE." u
WHERE tw.forum_id = $forum_id
AND tw.user_id NOT IN (".$userdata['user_id'].", ".ANONYMOUS.$user_id_sql.")
AND u.user_id = tw.user_id";
$result = $db->sql_query($sql);
$update_watched_sql = '';
$bcc_list_ary = array();
if ($row = $db->sql_fetchrow($result)) {
// Sixty second limit
set_time_limit(0);
do {
if ($row['user_email'] != '') {
$bcc_list_ary[$row['user_lang']][] = $row['user_email'];
}
$update_watched_sql .= ($update_watched_sql != '') ? ', ' . $row['user_id'] : $row['user_id'];
}
while ($row = $db->sql_fetchrow($result));
if (sizeof($bcc_list_ary)) {
include("includes/phpBB/emailer.php");
$emailer = new emailer();
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$topic_title = (count($orig_word)) ? preg_replace($orig_word, $replacement_word, htmlunprepare($topic_title)) : htmlunprepare($topic_title);
reset($bcc_list_ary);
while (list($user_lang, $bcc_list) = each($bcc_list_ary))
{
$emailer->use_template('topic_notify', $user_lang);
for ($i = 0; $i < count($bcc_list); $i++) {
$emailer->bcc($bcc_list[$i]);
}
// The Topic_reply_notification lang string below will be used
// if for some reason the mail template subject cannot be read
// ... note it will not necessarily be in the posters own language!
// modificacion importante
$emailer->set_subject($lang['Forum_watch_subject'].": $forum_id: - ".$topic_title);
// translators update their templates
$emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg);
$emailer->assign_vars(array(
'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
'SITENAME' => $board_config['sitename'],
// Important Modify
'TOPIC_TITLE' => $lang['Forum_watch_subject'].": $forum_id: - ".$topic_title,
'U_TOPIC' => getlink('&file=viewtopic&' . POST_POST_URL . "=$post_id", true, true)."#$post_id",
'U_STOP_WATCHING_TOPIC' => getlink("&file=viewforum&f=$forum_id&unwatch=forum", true, true))
);
$emailer->send();
$emailer->reset();
}
}
}
$db->sql_freeresult($result);
}
////// Fin Observar Foro - End of Forum Watch //////
}
//
// Fill smiley templates (or just the variables) with smileys
// Either in a window or inline
//