// In order not to get all users who do not fulfill the conditions (in case of
// doubt there can be many), we filter for users who have received the trophy.
$userList->getConditionBuilder()->add('user_table.userID IN (SELECT userID FROM wcf'.WCF_N.'_user_trophy WHERE trophyID IN (?))', [$trophy->trophyID]);
+
+ // Prevents us from getting faulty UserTrophyIDs.
+ $userList->getConditionBuilder()->add('user_trophy.trophyID = ?', [$trophy->trophyID]);
$userList->readObjects();
// We now return an array of userTrophyIDs instead of user objects to remove them directly via DBOAction.