Fix condition check for user trophies
authorMarcel Werk <burntime@woltlab.com>
Wed, 7 Sep 2022 16:04:23 +0000 (18:04 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 7 Sep 2022 16:04:23 +0000 (18:04 +0200)
The check was incorrectly not based on trophyID but on userTrophyID.

wcfsetup/install/files/lib/system/condition/UserTrophyCondition.class.php

index 8df5a6418243d8b56f5896198cc66c171412a268..be8c5ec2e5380a0683eaabb956747755185065ff 100644 (file)
@@ -102,8 +102,10 @@ class UserTrophyCondition extends AbstractMultipleFieldsCondition implements
      */
     public function checkUser(Condition $condition, User $user)
     {
-        $trophies = UserTrophyList::getUserTrophies([$user->getObjectID()], false)[$user->getObjectID()];
-        $trophyIDs = \array_keys($trophies);
+        $userTrophies = UserTrophyList::getUserTrophies([$user->getObjectID()], false)[$user->getObjectID()];
+        $trophyIDs = \array_map(static function ($userTrophy) {
+            return $userTrophy->trophyID;
+        }, $userTrophies);
 
         if (
             !empty($condition->conditionData['userTrophyIDs'])