January 18, 2004
There's a phpBB hack to add Forum-wide email notification to phpBB boards. It's a good hack, except that it generates notification emails for all replies to all forum topics. This is a bit too much notification.
Following is a method for reducing forum-level notification so that they are only sent when a new topic is created.
Presently listening to:
Kashmir - Led Zeppelin - Physical Graffitti (08:33)
Posted by Patrick at January 18, 2004 11:07 AM
- First, fully install and test the phpBB Forum Notification hack.
- Then, re-open the file include/functions_post.php
- Find
$sql = "SELECT u.user_id, u.username, u.user_email, u.user_lang, t.topic_title, f.forum_name
FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . FORUMS_WATCH_TABLE . " fw, " . FORUMS_TABLE . " f
WHERE fw.forum_id = $forum_id
AND fw.user_id NOT IN (" . $already_mailed . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . " )
AND t.topic_id = $topic_id
AND f.forum_id = $forum_id
AND f.forum_notify = '1'
AND u.user_id = fw.user_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "", "", __LINE__, __FILE__, $sql);
}
$script_name = preg_replace("/^\/?(.*?)\/?$/", "\\1", trim($board_config['script_path']));
$script_name_forum = ( $script_name != '' ) ? $script_name . '/viewforum.'.$phpEx : 'viewforum.'.$phpEx;
$script_name = ( $script_name != '' ) ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx;
$temp_is_auth = array();
if ( $row = $db->sql_fetchrow($result) )
{
$topic_title = preg_replace($orig_word, $replacement_word, unprepare_message($row['topic_title']));
$post_text = preg_replace($orig_word, $replacement_word, unprepare_message($post_data['message']));
do
{
$temp_userdata = get_userdata($row['user_id']);
$temp_is_auth = auth(AUTH_ALL, $forum_id, $temp_userdata, -1);
// another security check (i.e. the forum might have become private and
// there are still users who have notification activated)
if( $temp_is_auth['auth_read'] && $temp_is_auth['auth_view'] )
{
if ( $row['user_email'] != "" )
{
$emailer->use_template("forum_notify", $row['user_lang']);
$emailer->email_address($row['user_email']);
$emailer->set_subject();//$lang['Topic_reply_notification']
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array(
"EMAIL_SIG" => str_replace("
", "\n", "-- \n" . $board_config['board_email_sig']),
"USERNAME" => $row['username'],
"SITENAME" => $board_config['sitename'],
"TOPIC_TITLE" => $topic_title,
"POST_TEXT" => $post_text,
"POSTERNAME" => $post_data['username'],
"U_TOPIC" => $server_protocol . $server_name . $server_port . $script_name . "?" . POST_POST_URL . "=$post_id#$post_id",
"FORUM_NAME" => $row['forum_name'],
"U_STOP_WATCHING_FORUM" => $server_protocol . $server_name . $server_port .
$script_name_forum . "?" . POST_FORUM_URL . "=$forum_id&unwatch=forum")
);
$emailer->send();
$emailer->reset();
}
}
}
while ( $row = $db->sql_fetchrow($result) );
}
- Delete this code block (or comment it out). Careful! There's a similar block above this which sends the default phpBB topic-reply notification and you'll want to keep that.
Kashmir - Led Zeppelin - Physical Graffitti (08:33)
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Search
Search My Messy Workbench:
Archives
March 2005
June 2004
May 2004
February 2004
January 2004
December 2003
Category Index
June 2004
May 2004
February 2004
January 2004
December 2003
Category Index
Backburner |
Coffee Break |
Gems |
Instruction Manual |
Notebook |
Reviews |
Testbench |
To Do List |
Too Done List |
Toolbox
Recent Entries
The Way
Amazon Products Feed: Display the Most Popular Items
IFRAME and Amazon Product Feed:
Add Curly Quotes and Apostrophes regex/macro code
Getting more from your Amazon.ca/com/de/co.uk affiliations.
Google and Yahoo ranking test IV
Empty Media Things listing when MTAmazon search fails
Empty Media Things listing when MTAmazon search fails
Testing Trackback Display
MTAmazon ahref macro blank when search fails
Amazon Products Feed: Display the Most Popular Items
IFRAME and Amazon Product Feed:
Add Curly Quotes and Apostrophes regex/macro code
Getting more from your Amazon.ca/com/de/co.uk affiliations.
Google and Yahoo ranking test IV
Empty Media Things listing when MTAmazon search fails
Empty Media Things listing when MTAmazon search fails
Testing Trackback Display
MTAmazon ahref macro blank when search fails
things that are mine
Sponsored Ads
cOUNTER fLOW
mORE cOUNTER fLOW
XML Syndication
My Messy Workbench
Backburner | Coffee Break | Gems | Instruction Manual | Notebook | Reviews | Testbench | To Do List | Too Done List | Toolbox
My Messy Workbench
Backburner | Coffee Break | Gems | Instruction Manual | Notebook | Reviews | Testbench | To Do List | Too Done List | Toolbox
Powered by
Movable Type 2.661
Movable Type 2.661
MTMacros
| MTAmazon | Process_Tags | OverLib | phpBB Integration | MTSQL | MTTagInvoke | MTSwitch | MTGlue | MTRegex | Category Tags
Technorati Profile | Root Blog
Technorati Profile | Root Blog