As designed Trophies that don't meet the criteria anymore don't get deleted by the trophy rebuild job

MilkyMeda

Active member
Affected version
2.2.5
Is this deliberate?

src/XF/Repository/Trophy.php:63
PHP:
        foreach ($trophies AS $trophy)
        {
            if (isset($userTrophies[$user->user_id . '-' . $trophy->trophy_id]))
            {
                continue; //But the criteria is met?
            }

            $userCriteria = $this->app()->criteria('XF:User', $trophy->user_criteria);
            $userCriteria->setMatchOnEmpty(false);
            if ($userCriteria->isMatched($user))
            {
                $this->awardTrophyToUser($trophy, $user);
            }
        }
    }
 
Last edited:
I can see that. I wonder the logical reason behind that decision if there is any. We don't count the messages in some forums any longer and the trophies are still there. Newcomers are confused :unsure:
 
The logical reason is a trophy is an award. If you win the 500 dash and the next year they change it to the 600 you keep your award.
 
Valid point but trophies can be deleted and be removed from the users from the ACP anyway. I can remove the trophy and add it again to get what I want :P Since there are so many, it could be useful to let the rebuild job take care of them all.
 
That use case is better dealt with by hand, as you say. Stripping awards with a criteria change is not good practice.
 
Back
Top Bottom