1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Resolved Bug Reports' started by Xon, Oct 18, 2014.

  1. Xon

    Xon Well-Known Member


    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:
                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.
  2. Mike

    Mike XenForo Developer Staff Member

    This is very much as intended and designed. Changing this would totally change the behavior with time-based actions for example.
  3. Xon

    Xon Well-Known Member

    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.

Share This Page