From f9def4a725cdd5b6757dfa51866149906df8842d Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 23 Jan 2025 11:15:47 +0700 Subject: [PATCH] [ticket/17227] Fix rows duplication in memberlist PHPBB-17227 --- phpBB/memberlist.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index dce5eb8d90..126cb9b61a 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1390,10 +1390,10 @@ switch ($mode) $order_by .= $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); - // Unfortunately we must do this here for sorting by rank, else the sort order is applied wrongly - if ($sort_key == 'm') + // For sorting by non-unique columns (rank, posts) add unique sort key to avoid duplicated rows in results + if ($sort_key == 'm' || $sort_key == 'd') { - $order_by .= ', u.user_posts DESC'; + $order_by .= ', u.user_id ASC'; } /**