Firnagzen
Member
If an infraction is issued with 0 time (0 days/weeks etc), this results in a mismatch between the points displayed on the user's profile page (next to Last Activity, Messages, Likes etc) and the actual infractions still active against them. The bug is caused by library/XenForo/DataWriter/Warning.php:
This infraction is never actually expired using the _warningExpiredOrDeleted function, since that is only called on warnings that have is_expired set false. Thus the points are written to the user's profile display block, but never removed. A trivial fix would be to add a check before adding the points to the profile.
Code:
protected function _preSave()
{
...
if ($this->get('expiry_date') > 0 AND $this->get('expiry_date') <= XenForo_Application::$time)
{
$this->set('is_expired', 1);
}
}
Code:
protected function _postSave()
{
if ($this->isInsert() || ($this->get('is_expired') == 0 && $this->getExisting('is_expired') == 1))
{
...
if ($this->get('points'))
{
$userDw = XenForo_DataWriter::create('XenForo_DataWriter_User', XenForo_DataWriter::ERROR_SILENT);
if ($userDw->setExistingData($this->get('user_id')))
{
$userDw->set('warning_points', $userDw->get('warning_points') + $this->get('points'));
$userDw->save();
}
}}
Last edited: