Warning Improvements by Xon

Warning Improvements by Xon 2.9.5

No permission to download
Trying to install, got an error.. :eek:

Code:
XF\Db\Exception: MySQL statement prepare error [1054]: Unknown column 'warning_count' in 'field list' in src/XF/Db/AbstractStatement.php at line 212

1. XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
2. XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 39
3. XF\Db\Mysqli\Statement->prepare() in src/XF/Db/Mysqli/Statement.php at line 54
4. XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 79
5. XF\Db\AbstractAdapter->query() in src/addons/SV/WarningImprovements/Setup.php at line 83
6. SV\WarningImprovements\Setup->installStep4() in src/XF/AddOn/StepRunnerInstallTrait.php at line 60
7. SV\WarningImprovements\Setup->installStepRunner() in src/XF/AddOn/StepRunnerInstallTrait.php at line 27
8. SV\WarningImprovements\Setup->install() in src/XF/Admin/Controller/AddOn.php at line 390
9. XF\Admin\Controller\AddOn->actionInstall() in src/XF/Mvc/Dispatcher.php at line 249
10. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 88
11. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
12. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1891
13. XF\App->run() in src/XF.php at line 328
14. XF::runApp() in admin.php at line 13

@Xon still get this error with 2.1.3

I removed all files/folders and reupload the new one. In Acp it is called 2.0.0 to install and not 2.1.3

Screenshot 2018-04-21 19.33.38.webp
 
@mcatze that is known XF2 "oddness" (I think there is a bug report for it), just upgrade/install it and it should show the correct version.
 
just upgrade/install it and it should show the correct version.
I would do this, if i could. But, i upload all new files and it is shown as 2.0.0 and not as 2.1.3 also the install/upgrade process failed with the known error.
 
I would do this, if i could. But, i upload all new files and it is shown as 2.0.0 and not as 2.1.3 also the install/upgrade process failed with the known error.
2.1.3's installer does not match the 2.0.0 installer, and would not generate the same error message. Please post the full error message of the most recent install attempt in a conversation with me
 
@Xon after I have installed it, as an Admin I can't access infractions anymore :(
You need to provide more information, is this editing Warning Definitions or when issuing a warning to a user? Terminology matters.

Did you read the product description, with the bits in bold and red about needing to configure permissions on warning categories if you do not have the registered user group (id 4) as part of the 'admin user' usergroup set.
 
This is great addon, thanks xon. I would like to see then options to:

  • Add some custom message to the warning info. e.g. I have edited the template to include a link to my help page that explains the warning system to members.
  • Option to make warned members re-accept the terms & conditions
 
This is great addon, thanks xon. I would like to see then options to:

  • Add some custom message to the warning info. e.g. I have edited the template to include a link to my help page that explains the warning system to members.
  • Option to make warned members re-accept the terms & conditions
I am planning on porting Warning Acknowledgement to XF2 which does most of this sort of thing. It is however a paid add-on
 
Does this add-on add the 'Warning Actions' tab on a users profile or is that default XF?

If it is this add-on...

I'm not sure the 'Warning Action Expiry' date is correct.

Example: I have set up a warning that adds 1 point to a user. I have also set up a warning action with a threshold of 2 warning points.

So... if I issue a warning that expires in 7 days, the user has one point and no action takes place.

If I issue the same user with the same warning that expires in 1 day they now have 2 points and the Warning Action is applied.

The Warning Action Expiry date on the users profile shows as being 7 days from now. When that 2nd warning of 1 day expires they will no longer be above the threshold and the warning action would expire then, wouldn't it? So that date should be in 1 days time not 7.
 
Last edited:
This add-on does add the 'Warning Actions' tab, the 'Warning Action Expiry' date is computed as 'warning actions' can have fairly complex expiry rules.

You need to carefully check to see how the warning actions expire (time or points based). If they are set to be a time duration, then it doesn't matter if the warning points expire.
 
This add-on does add the 'Warning Actions' tab, the 'Warning Action Expiry' date is computed as 'warning actions' can have fairly complex expiry rules.

You need to carefully check to see how the warning actions expire (time or points based). If they are set to be a time duration, then it doesn't matter if the warning points expire.
I've check all the settings I still don't understand how this is working.

If a warning action setting is "While at or above points threshold" and the threshold for a warning action is 2 warning points then surely the 'warning action expiry' date is the nearest date from either of the 2 warnings a user has received? When one warning expires then they have dropped below that threshold and this is the actual date when the warning action expires.

At the moment it just seems to use whatever date the first warning they receive is.

My setup:
Warning
Warning Points: 1
Points Expiry - After Time: 7 Days
Points and expiry time are editable when giving warning - Checked (This is how I alter the length of the 2nd warning)

Warning Action
Points Threshold: 2
For time period: While at or above points threshold
 
Latest XF 2, with dev mode on right now, getting this:

Code:
ErrorException: [E_NOTICE] Trying to get property 'Category' of non-object src/addons/SV/WarningImprovements/XF/Service/User/WarningPointsChange.php:147
Generated by: Unknown account Jul 18, 2018 at 7:13 AM

Stack trace

#0 src/addons/SV/WarningImprovements/XF/Service/User/WarningPointsChange.php(147): XF::handlePhpError(8, '[E_NOTICE] Tryi...', '/home/nginx/dom...', 147, Array)
#1 src/addons/SV/WarningImprovements/XF/Service/User/WarningPointsChange.php(309): SV\WarningImprovements\XF\Service\User\WarningPointsChange->getCategoryPoints(true)
#2 src/XF/Service/User/WarningPointsChange.php(47): SV\WarningImprovements\XF\Service\User\WarningPointsChange->processPointsDecrease(40, 10, false)
#3 src/XF/Service/User/WarningPointsChange.php(23): XF\Service\User\WarningPointsChange->setToPoints(10, false)
#4 src/XF/Entity/Warning.php(213): XF\Service\User\WarningPointsChange->shiftPoints(-30, false)
#5 src/addons/SV/WarningImprovements/XF/Entity/Warning.php(167): XF\Entity\Warning->updateUserWarningPoints(Object(SV\UserEssentials\XF\Entity\User), -30, false)
#6 src/XF/Entity/Warning.php(200): SV\WarningImprovements\XF\Entity\Warning->updateUserWarningPoints(Object(SV\UserEssentials\XF\Entity\User), -30, false)
#7 src/XF/Entity/Warning.php(143): XF\Entity\Warning->onExpiration(false)
#8 src/XF/Mvc/Entity/Entity.php(1145): XF\Entity\Warning->_postSave()
#9 src/XF/Repository/Warning.php(49): XF\Mvc\Entity\Entity->save()
#10 src/XF/Cron/Warnings.php(9): XF\Repository\Warning->processExpiredWarnings()
#11 [internal function]: XF\Cron\Warnings::expireWarnings(Object(XF\Entity\CronEntry))
#12 src/XF/Job/Cron.php(35): call_user_func(Array, Object(XF\Entity\CronEntry))
#13 src/XF/Job/Manager.php(241): XF\Job\Cron->run(7.9999990463257)
#14 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 7.9999990463257)
#15 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 7.9999990463257)
#16 job.php(15): XF\Job\Manager->runQueue(false, 8)
#17 {main}

Request state

array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(32) "https://www.ptsdnews.com/forums/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
Thanks for getting this ported over Xon. I have a couple things...

1. In the options I have "Send warning conversations by default" checked, but when I go to issue a warning the conversation box is unchecked. Ideally I'd like to force moderators to send a message with a warning, but I know that isn't a feature (at this point).

2. In my warning list I seem to have a 'ghost warning'. It's warning ID is zero and it's title is warning_title.0 (which I'm unable to change). There's no option to delete it on the warning list page or the edit warning page.
 
Thanks for getting this ported over Xon. I have a couple things...

1. In the options I have "Send warning conversations by default" checked, but when I go to issue a warning the conversation box is unchecked. Ideally I'd like to force moderators to send a message with a warning, but I know that isn't a feature (at this point).
This should be working, but I'm guessing it is a bug.

2. In my warning list I seem to have a 'ghost warning'. It's warning ID is zero and it's title is warning_title.0 (which I'm unable to change). There's no option to delete it on the warning list page or the edit warning page.
This is the Custom Warning, you'll need to edit the phrase to correctly have the right title. I'll need to check the upgrade process to make sure it is setup properly.
 
Latest XF 2, with dev mode on right now, getting this:

Code:
ErrorException: [E_NOTICE] Trying to get property 'Category' of non-object src/addons/SV/WarningImprovements/XF/Service/User/WarningPointsChange.php:147
Generated by: Unknown account Jul 18, 2018 at 7:13 AM

Stack trace

#0 src/addons/SV/WarningImprovements/XF/Service/User/WarningPointsChange.php(147): XF::handlePhpError(8, '[E_NOTICE] Tryi...', '/home/nginx/dom...', 147, Array)
#1 src/addons/SV/WarningImprovements/XF/Service/User/WarningPointsChange.php(309): SV\WarningImprovements\XF\Service\User\WarningPointsChange->getCategoryPoints(true)
#2 src/XF/Service/User/WarningPointsChange.php(47): SV\WarningImprovements\XF\Service\User\WarningPointsChange->processPointsDecrease(40, 10, false)
#3 src/XF/Service/User/WarningPointsChange.php(23): XF\Service\User\WarningPointsChange->setToPoints(10, false)
#4 src/XF/Entity/Warning.php(213): XF\Service\User\WarningPointsChange->shiftPoints(-30, false)
#5 src/addons/SV/WarningImprovements/XF/Entity/Warning.php(167): XF\Entity\Warning->updateUserWarningPoints(Object(SV\UserEssentials\XF\Entity\User), -30, false)
#6 src/XF/Entity/Warning.php(200): SV\WarningImprovements\XF\Entity\Warning->updateUserWarningPoints(Object(SV\UserEssentials\XF\Entity\User), -30, false)
#7 src/XF/Entity/Warning.php(143): XF\Entity\Warning->onExpiration(false)
#8 src/XF/Mvc/Entity/Entity.php(1145): XF\Entity\Warning->_postSave()
#9 src/XF/Repository/Warning.php(49): XF\Mvc\Entity\Entity->save()
#10 src/XF/Cron/Warnings.php(9): XF\Repository\Warning->processExpiredWarnings()
#11 [internal function]: XF\Cron\Warnings::expireWarnings(Object(XF\Entity\CronEntry))
#12 src/XF/Job/Cron.php(35): call_user_func(Array, Object(XF\Entity\CronEntry))
#13 src/XF/Job/Manager.php(241): XF\Job\Cron->run(7.9999990463257)
#14 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 7.9999990463257)
#15 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 7.9999990463257)
#16 job.php(15): XF\Job\Manager->runQueue(false, 8)
#17 {main}

Request state

array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(32) "https://www.ptsdnews.com/forums/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
Please run this SQL;

SQL:
update xf_warning_definition
set sv_warning_category_id = (select min(warning_category_id) from xf_sv_warning_category)
where sv_warning_category_id is null or sv_warning_category_id not in (select warning_category_id from xf_sv_warning_category)

I'll look into hardening the code so this error doesn't happen again, but this will hotfix it
 
A couple of errors which seem to have been generated when I logged in to ACP.

Seems odd that it should just start now as I updated to 2.1.5 on 18 May and all has been fine.

Code:
Server error log
ErrorException: [E_NOTICE] Trying to get property 'Category' of non-object src/addons/SV/WarningImprovements/XF/Service/User/WarningPointsChange.php:147
Generated by: Unknown account Aug 2, 2018 at 7:56 PM
Stack trace
#0 src/addons/SV/WarningImprovements/XF/Service/User/WarningPointsChange.php(147): XF::handlePhpError(8, '[E_NOTICE] Tryi...', '/home/caf/publi...', 147, Array)
#1 src/addons/SV/WarningImprovements/XF/Service/User/WarningPointsChange.php(309): SV\WarningImprovements\XF\Service\User\WarningPointsChange->getCategoryPoints(true)
#2 src/XF/Service/User/WarningPointsChange.php(47): SV\WarningImprovements\XF\Service\User\WarningPointsChange->processPointsDecrease(3, 0, false)
#3 src/XF/Service/User/WarningPointsChange.php(23): XF\Service\User\WarningPointsChange->setToPoints(0, false)
#4 src/XF/Entity/Warning.php(213): XF\Service\User\WarningPointsChange->shiftPoints(-3, false)
#5 src/addons/SV/WarningImprovements/XF/Entity/Warning.php(167): XF\Entity\Warning->updateUserWarningPoints(Object(SV\WarningImprovements\XF\Entity\User), -3, false)
#6 src/XF/Entity/Warning.php(200): SV\WarningImprovements\XF\Entity\Warning->updateUserWarningPoints(Object(SV\WarningImprovements\XF\Entity\User), -3, false)
#7 src/XF/Entity/Warning.php(143): XF\Entity\Warning->onExpiration(false)
#8 src/XF/Mvc/Entity/Entity.php(1145): XF\Entity\Warning->_postSave()
#9 src/XF/Repository/Warning.php(49): XF\Mvc\Entity\Entity->save()
#10 src/XF/Cron/Warnings.php(9): XF\Repository\Warning->processExpiredWarnings()
#11 [internal function]: XF\Cron\Warnings::expireWarnings(Object(XF\Entity\CronEntry))
#12 src/XF/Job/Cron.php(35): call_user_func(Array, Object(XF\Entity\CronEntry))
#13 src/XF/Job/Manager.php(241): XF\Job\Cron->run(7.9999990463257)
#14 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 7.9999990463257)
#15 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 7.9999990463257)
#16 job.php(15): XF\Job\Manager->runQueue(false, 8)
#17 {main}
Request state
array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(26) "https://cafesaxophone.com/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
Last edited:
Top Bottom