As designed Adding a warning action doesn't work as expected.

Xon

Well-known member
Hi,

If I had a warning action with a 1 point threshold, this warning action doesn't get picked up on the next warning for a user with non-zero warning points.

For users without any warning points it functions as expected.

The function XenForo_Model_Warning::userWarningPointsIncreased has the following bit of code:
Code:
            if ($action['points'] <= $oldPoints)
            {
                continue; // already triggered - not necessarily true when an action is added though, but probably ok
            }
Which for a new points-based warning action is obviously wrong.

Calling XenForo_Model_Warning::triggerWarningAction when adding a new warning action is the obvious solution, to have warning action apply as expected.

Editing obviously gets trickier, but it's really just a case of applying variant of 'XenForo_Model_Warning::userWarningPointsChanged' to determine if the warning action needs to be applied or removed.
 
This is very much as intended and designed. Changing this would totally change the behavior with time-based actions for example.
 
This is incredibly non-obvious behaviour that creating a new warning actions can potentially never be applicable for a user at all, despite the UI indicating it should be.

I had to dig through the code to figure out what was even happening, as the UI just provided no feedback.
 
Back
Top Bottom