Not a bug Custom warning error

Delazar

Active member
Affected version
2.1.2
Hello,

if I warn a user over 10 points in the custom warning, I get this error message:

Code:
XF\Db\Exception: MySQL query error [1364]: Field 'ts_ban_id' doesn't have a default value src/XF/Db/AbstractStatement.php:217


INSERT  INTO `xf_user_ban` (`user_id`, `ban_user_id`, `user_reason`, `end_date`, `ban_date`, `triggered`) VALUES (?, ?, ?, ?, ?, ?)
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1364, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1364, 'HY000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(221): XF\Db\AbstractAdapter->query('INSERT  INTO `x...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1452): XF\Db\AbstractAdapter->insert('xf_user_ban', Array, false)
#5 src/XF/Mvc/Entity/Entity.php(1184): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Service/User/WarningPointsChange.php(191): XF\Mvc\Entity\Entity->save()
#7 src/addons/MeanCatStudio/XFInfractionPost/XF/Service/User/WarningPointsChange.php(12): XF\Service\User\WarningPointsChange->applyUserBan(1562587408, false)
#8 src/XF/Service/User/WarningPointsChange.php(124): MeanCatStudio\XFInfractionPost\XF\Service\User\WarningPointsChange->applyUserBan(1562587408, false)
#9 src/XF/Service/User/WarningPointsChange.php(66): XF\Service\User\WarningPointsChange->applyWarningAction(Object(XF\Entity\WarningAction))
#10 src/XF/Service/User/WarningPointsChange.php(43): XF\Service\User\WarningPointsChange->processPointsIncrease(3, 103)
#11 src/XF/Service/User/WarningPointsChange.php(23): XF\Service\User\WarningPointsChange->setToPoints(103, false)
#12 src/XF/Entity/Warning.php(213): XF\Service\User\WarningPointsChange->shiftPoints(100, false)
#13 src/XF/Entity/Warning.php(185): XF\Entity\Warning->updateUserWarningPoints(Object(Siropu\Chat\XF\Entity\User), 100)
#14 src/XF/Entity/Warning.php(130): XF\Entity\Warning->onApplication()
#15 src/XF/Mvc/Entity/Entity.php(1208): XF\Entity\Warning->_postSave()
#16 src/XF/Service/User/Warn.php(172): XF\Mvc\Entity\Entity->save()
#17 src/XF/Service/ValidateAndSavableTrait.php(40): XF\Service\User\Warn->_save()
#18 src/XF/ControllerPlugin/Warn.php(41): XF\Service\User\Warn->save()
#19 src/XF/Pub/Controller/Member.php(1017): XF\ControllerPlugin\Warn->actionWarn('user', Object(Siropu\Chat\XF\Entity\User), '/members/robina...')
#20 src/XF/Mvc/Dispatcher.php(321): XF\Pub\Controller\Member->actionWarn(Object(XF\Mvc\ParameterBag))
#21 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Member', 'Warn', Object(XF\Mvc\RouteMatch), Object(Xfrocks\Medal\XF\Pub\Controller\Member), NULL)
#22 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Xfrocks\Medal\XF\Pub\Controller\Member), NULL)
#23 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#24 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()


Status der Anfrage

array(4) {
  ["url"] => string(31) "/members/robinandroid.4169/warn"
  ["referrer"] => string(60) "https://my.domain/members/robinandroid.4169/warn"
  ["_GET"] => array(1) {
    ["/members/robinandroid_4169/warn"] => string(0) ""
  }
  ["_POST"] => array(11) {
    ["warning_definition_id"] => string(1) "0"
    ["custom_title"] => string(6) "wqewqe"
    ["points_enable"] => string(1) "1"
    ["points"] => string(3) "100"
    ["notes"] => string(5) "wqewq"
    ["_xfRedirect"] => string(60) "https://my.domain/members/robinandroid.4169/warn"
    ["filled_warning_definition_id"] => string(1) "0"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(31) "/members/robinandroid.4169/warn"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}


#25 src/XF.php(390): XF\App->run()
 
This appears to be related to an add-on which has added a new field named ts_ban_id. If the add-on developer hasn't followed best practise then it is possible that the add-on may not even be enabled or even still installed. You'll need to figure out which add-on added that field and seek their advice to rectify it.
 
Back
Top Bottom