diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index cdfde4c7ea..d77d46d46d 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1113,10 +1113,13 @@ function phpbb_delete_user_pms($user_id) while ($row = $db->sql_fetchrow($result)) { + $msg_id = (int) $row['msg_id']; + $delete_ids[$msg_id] = $msg_id; + if ($row['author_id'] == $user_id && $row['folder_id'] == PRIVMSGS_NO_BOX) { // Undelivered messages - $undelivered_msg[] = $row['msg_id']; + $undelivered_msg[] = $msg_id; if (isset($undelivered_user[$row['user_id']])) { @@ -1127,8 +1130,6 @@ function phpbb_delete_user_pms($user_id) $undelivered_user[$row['user_id']] = 1; } } - - $delete_ids[(int) $row['msg_id']] = (int) $row['msg_id']; } $db->sql_freeresult($result); @@ -1141,8 +1142,11 @@ function phpbb_delete_user_pms($user_id) while ($row = $db->sql_fetchrow($result)) { + $msg_id = (int) $row['msg_id']; + $delete_ids[$msg_id] = $msg_id; + // Undelivered messages - $undelivered_msg[] = $row['msg_id']; + $undelivered_msg[] = $msg_id; if (isset($undelivered_user[$row['user_id']])) { @@ -1152,8 +1156,6 @@ function phpbb_delete_user_pms($user_id) { $undelivered_user[$row['user_id']] = 1; } - - $delete_ids[(int) $row['msg_id']] = (int) $row['msg_id']; } $db->sql_freeresult($result);