EDIT: Für $sql = "SELECT user_email FROM " . USERS_TABLE . " WHERE user_level = 2"; erhalte ich die Fehlermeldung "Diese Gruppe existiert nicht". Ich habe mich als Admin aber in dem Testforum als "Moderator" eingetragen....hmhm, ich denke mal, da ich als Admin einen anderen Level habe, oder? da sollte die Abfrage dann anders aufgebaut werden...oder?
...an dieser Stelle muß ich mal eben was nachhaken bzgl. der functions_post.php
Ich hab die emailer-stelle jetzt so drin (wieder versucht ne "USERNAME"-Variable hinzuzufügen und deinen Tipp mit der $this_userdata....aber leider krieg ich in der topic_notify.tpl-mail für die Variable "USERNAME" nur "" angezeigt...
Code: Alles auswählen
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));
$this_userdata = get_userdata($user_id);
//
// Let's do some checking to make sure that mass mail functions
// are working in win32 versions of php.
//
if (preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery'])
{
$ini_val = (@phpversion() >= '4.0.0') ? 'ini_get' : 'get_cfg_var';
// We are running on windows, force delivery to use our smtp functions
// since php's are broken by default
$board_config['smtp_delivery'] = 1;
$board_config['smtp_host'] = @$ini_val('SMTP');
}
if (sizeof($bcc_list_ary))
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
$script_name = ($script_name != '') ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$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']) . '/' : '/';
$server_url = $server_protocol . $server_name . $server_port . $script_name;
$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, unprepare_message($topic_title)) : unprepare_message($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!
$emailer->set_subject($lang['Topic_reply_notification']);
$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'],
'USERNAME' => $this_userdata['username'],
'TOPIC_TITLE' => $topic_title,
'POST_USERNAME' => $userdata['username'],
'MESSAGE' => $post_message,
'U_TOPIC' => $server_url . '?' . POST_POST_URL . "=$post_id#$post_id",
'U_STOP_WATCHING_TOPIC' => $server_url . '?' . POST_TOPIC_URL . "=$topic_id&unwatch=topic")
);
$emailer->send();
$emailer->reset();