From 470b79c9e38ea5c37fe5f4685618e5794b6954ad Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Fri, 24 Feb 2012 07:41:08 +0000 Subject: [PATCH 1/2] [ticket/8652] Sending 2 emails on 2 replies This is a fix for the problem of the system sending 2 emails when there are 2 replies to a topic where the user is subscribed in a topic and the forum that contains the topic. This simple fix seems to solve the problem. In simple tests I made it shows it does. PHPBB3-8652 --- phpBB/includes/functions_posting.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 77d92e26e2..38f542264c 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1286,6 +1286,12 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id { $msg_users[] = $row; $update_notification[$row['notify_type']][] = $row['user_id']; + if ($row['notify_type'] === 'topic') + { + // Using SQL characteristics. If it didn't exist it isn't added. + // It's very rare to find someone that is registered in topic and noone is registered in the forum + $update_notification['forum'][] = $row['user_id']; + } } } unset($notify_rows); From b74530259faa6197d7215d957c180280210a93e0 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 2 Mar 2012 00:19:42 +0100 Subject: [PATCH 2/2] [ticket/8652] Comment for also updating forum watch table in user_notification. PHPBB3-8652 --- phpBB/includes/functions_posting.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 38f542264c..f920be9c4b 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1286,10 +1286,18 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id { $msg_users[] = $row; $update_notification[$row['notify_type']][] = $row['user_id']; + + /* + * We also update the forums watch table for this user when we are + * sending out a topic notification to prevent sending out another + * notification in case this user is also subscribed to the forum + * this topic was posted in. + * Since an UPDATE query is used, this has no effect on users only + * subscribed to the topic (i.e. no row is created) and should not + * be a performance issue. + */ if ($row['notify_type'] === 'topic') { - // Using SQL characteristics. If it didn't exist it isn't added. - // It's very rare to find someone that is registered in topic and noone is registered in the forum $update_notification['forum'][] = $row['user_id']; } }