diff --git a/protected/humhub/modules/user/components/PeopleQuery.php b/protected/humhub/modules/user/components/PeopleQuery.php index 0b38767bfd..82e6deaa17 100644 --- a/protected/humhub/modules/user/components/PeopleQuery.php +++ b/protected/humhub/modules/user/components/PeopleQuery.php @@ -211,8 +211,8 @@ class PeopleQuery extends ActiveQueryUser if (empty($defaultSortingGroupId)) { $this->addOrderBy('last_login DESC'); } else { - $this->leftJoin('group_user', 'group_user.user_id = user.id AND group_user.group_id = :defaultGroupId', [':defaultGroupId' => $defaultSortingGroupId]); - $this->addOrderBy('group_user.group_id DESC, last_login DESC'); + $this->leftJoin('group_user AS top_group_sorting', 'top_group_sorting.user_id = user.id AND top_group_sorting.group_id = :defaultGroupId', [':defaultGroupId' => $defaultSortingGroupId]); + $this->addOrderBy('top_group_sorting.group_id DESC, last_login DESC'); } }