Fix revoking of user trophies
authorJoshua Rüsweg <ruesweg@woltlab.com>
Mon, 20 Jan 2020 16:37:41 +0000 (17:37 +0100)
committerJoshua Rüsweg <ruesweg@woltlab.com>
Mon, 20 Jan 2020 16:37:47 +0000 (17:37 +0100)
wcfsetup/install/files/lib/system/trophy/condition/TrophyConditionHandler.class.php

index 09bc0c88c1cd0e21e73ed3d0ab9b8cc6959175d3..c7da8e79cfc97eb05ef909e3366842d108a72d4c 100644 (file)
@@ -182,6 +182,9 @@ class TrophyConditionHandler extends SingletonFactory {
                // 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.