I found and fixed a race condition that results in trophies being awarded to members who do not meet the criteria. The issue is in /sources/Trophy/Trophy.php on line 193, inside the function formatFormValues.
#$this->crdata = $data;
$values['crdata'] = $data;
$this->faicon = $values['faicon'];
if ( !$this->id )
{
$this->save();
}
// ...
return $values
The problem is that `$this->crdata` is not being set before `$this->save()` is called. IPS will later use the results of this function (`$values`) to update the model, but not before an active background task can assign the trophy.
The simplest fix is to simply uncomment the line of code on line 193. I have not encountered this issue after applying this fix, but because of the way race conditions work, that doesn't necessarily prove anything.