diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 0fd40d26db..0d09c5dc00 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -148,6 +148,7 @@
  • [Change] Ability to fetch moderators with get_moderators() even if load_moderators setting is off. (Bug #35955)
  • [Change] Add WAI-ARIA landmarks for easier accessibility to the prosilver template (Bug #45715 - Patch by MarcoZ)
  • [Change] "Post details" links with image in MCP. (Bug #39845 - Patch by leviatan21)
  • +
  • [Change] Pm history only shows pms of the receipts you currently reply to (Bug #39505 - Patch by nickvergessen)
  • [Change] Add quote-button for own pm's in pm-history (Bug #37285 - Patch by nickvergessen)
  • [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
  • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
  • diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 271cce9f42..8851b53680 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1691,12 +1691,29 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode { global $db, $user, $config, $template, $phpbb_root_path, $phpEx, $auth, $bbcode; + // Select all receipts and the author from the pm we currently view, to only display their pm-history + $sql = 'SELECT author_id, user_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE msg_id = $msg_id + AND folder_id <> " . PRIVMSGS_HOLD_BOX; + $result = $db->sql_query($sql); + + $recipients = array(); + while ($row = $db->sql_fetchrow($result)) + { + $recipients[] = $row['user_id']; + $recipients[] = $row['author_id']; + } + $db->sql_freeresult($result); + $recipients = array_unique($recipients); + // Get History Messages (could be newer) $sql = 'SELECT t.*, p.*, u.* FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u WHERE t.msg_id = p.msg_id AND p.author_id = u.user_id - AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ") + AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') + AND ' . $db->sql_in_set('t.author_id', $recipients) . " AND t.user_id = $user_id"; if (!$message_row['root_level'])