This mod looks like just what I need, but I've got a problem with posting.php - I have another mod (admin email topics to selected groups) that has changed this file considerably. Can you please take a look at my code, and let me know if it's still possible to use your mod (and if so, the code changes needed)?
Code: Select all
if ($error_msg == '' && $mode != 'poll_delete')
// the following code is borrowed from David Herrmann's forum notification mod on phpbbhacks...
// the code replaced the original lines in phpbb that read 'user_notification($mode blah blah...
// but I changed the fourth line below this to test whether mode is newtopic rather than whether post is first post to avoid repeat emails when a first post is edited numerous times...
$post_data['subject'] = $subject;
$post_data['username'] = ( $userdata['user_id'] == ANONYMOUS ) ? $username : $userdata['username'];
$post_data['message'] = $message;
if ( $mode == 'newtopic' )
// fetch topic title
$sql = "SELECT topic_title, topic_id
FROM " . TOPICS_TABLE . "
WHERE topic_id = $topic_id";
if ( !($result = $db->sql_query($sql)) )
message_die(GENERAL_ERROR, 'Could not obtain topic title for notification', '', __LINE__, __FILE__, $sql);
if ( $topic_info = $db->sql_fetchrow($result) )
user_notification('newtopic', $post_data, $topic_info['topic_title'], $forum_id, $topic_id, $post_id, $notify_user, $mail_to_enabled_groups, $include_text, $include_unauthorized_users, $group_id, $email_re, $board_signs);
user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $post_id, $notify_user, $mail_to_enabled_groups, $include_text, $include_unauthorized_users, $group_id, $email_re, $board_signs);
// end mod email to designated groups
Thanks for any help!