Warning Improvements by Xon

Warning Improvements by Xon 2.9.5

No permission to download
There is a XenForo user-group permission "Delete all warnings", and this add-on adds the following user-group permissions; "Delete all warnings for Moderators" and "Delete all warnings for Administrators"

I see the default "Delete all warnings" permission in usergroup permissions but not the other two.
 
Whoops, Can Warn Staff (free addon) adds those permissions.

Ah, there we go!

  • Delete all warnings for Moderators.
  • Delete all warnings for Administrators.

I'm just a tad unclear on the phrasing, as 'delete all' sounds like mass deleting. Can I use this to prevent them from deleting individual warnings that they've issued? How about editing the warning expiration?

No big deal if not as I can add a conditional to the templates to show those options only to admins, I just try to avoid template edits when I can :)
 
Yes, those permissions control deleting individual warnings as there is no 'mass delete' handling of warnings in Xenforo (or added by my add-ons)
 
Reupload all the files in the upload/ folder in the zip, and ensure your client isn't mutilating files by "helpfully" converting line-endings

Preferably use the add-on installer UI that XF has, as it extracts evrything as required.
Hey

So i should upload the contents of src and js to the server? Not the src folder itself as it would overright my other files.
 
You need to upload all the contents, and merge them into the existing folders.

Please use the XF2.1 built-in add-on installer, as installing add-ons is well beyond support I offer for my add-ons..
 
1. When you disable the "View own warnings" option, it gives an error when viewing someone else's profile with the "View Warning Actions" option enabled in the "User group permissions" settings:
Oops! We ran into some problems.
The requested user could not be found.
2019-07-02 18_16_26-Greenshot.jpg

I’m sure this option check is superfluous in the canViewWarningActions function of the \src\addons\SV\WarningImprovements\XF\Entity\User.php file. Without which everything works correctly:
PHP:
        if ($visitor->user_id == $this->user_id)

        {

            return \XF::options()->sv_view_own_warnings;

        }

При отключении опции "View own warnings", выдаёт ошибку при просмотре чужого профиля с включённой опцией "View Warning Actions" в настройках "User group permissions"
Oops! We ran into some problems.
The requested user could not be found.
2019-07-02 18_16_26-Greenshot.jpg
Я уверен, эта проверка опции лишняя в функции canViewWarningActions файла \src\addons\SV\WarningImprovements\XF\Entity\User.php. Без которой всё работает правильно:
PHP:
        if ($visitor->user_id == $this->user_id)

        {

            return \XF::options()->sv_view_own_warnings;

        }

2. When the checkbox in the option "Points and expiry time are editable when giving warning" is checked, the options "Warning Escalating Defaults" do not work correctly, do not increase the warning days by the number of points, if the options are disabled, then everything works correctly. Watch the video, I hope it will be clear, or ask clarifying questions.
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

При установке флажка в опции "Points and expiry time are editable when giving warning", некорректно работают опции "Warning Escalating Defaults", не увеличивают дни предупреждений на количество баллов, если опции отключить, то всё работает правильно. Смотрите видео, надеюсь будет понятно, или задайте уточняющие вопросы.
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Xenforo: v2.1.2
Mod's: Warning Improvements by Xon 2.2.12
PHP: 7.2.10
 
Fix duplicate : in phrase when issuing a warning with radio selectors
They stayed:
2019-07-02 23_23_51-Greenshot.webp

It is generally necessary to remove the colon from the code of the sv_warning_action_edit template:
Code:
<xf:selectrow name="sv_warning_category_id" value="{$warning.sv_warning_category_id}" label="{{ phrase('sv_warning_category:') }}">
Fix like this:
Code:
<xf:selectrow name="sv_warning_category_id" value="{$warning.sv_warning_category_id}" label="{{ phrase('sv_warning_category') }}">

And in other templates also remove the colon ;)

It is duplicated, because in addition styles colon is put:
2019-07-02 23_41_57-Greenshot.webp
 
They stayed:
View attachment 205726

It is generally necessary to remove the colon from the code of the sv_warning_action_edit template:
Code:
<xf:selectrow name="sv_warning_category_id" value="{$warning.sv_warning_category_id}" label="{{ phrase('sv_warning_category:') }}">
Fix like this:
Code:
<xf:selectrow name="sv_warning_category_id" value="{$warning.sv_warning_category_id}" label="{{ phrase('sv_warning_category') }}">

And in other templates also remove the colon ;)

It is duplicated, because in addition styles colon is put:
View attachment 205730
There is a radio-box selector and select-box selector options; only one was fixed last release.

Should be fixed for the next release

1. When you disable the "View own warnings" option, it gives an error when viewing someone else's profile with the "View Warning Actions" option enabled in the "User group permissions" settings:

View attachment 205705

I’m sure this option check is superfluous in the canViewWarningActions function of the \src\addons\SV\WarningImprovements\XF\Entity\User.php file. Without which everything works correctly:
PHP:
        if ($visitor->user_id == $this->user_id)

        {

            return \XF::options()->sv_view_own_warnings;

        }

При отключении опции "View own warnings", выдаёт ошибку при просмотре чужого профиля с включённой опцией "View Warning Actions" в настройках "User group permissions"

View attachment 205705
Я уверен, эта проверка опции лишняя в функции canViewWarningActions файла \src\addons\SV\WarningImprovements\XF\Entity\User.php. Без которой всё работает правильно:
PHP:
        if ($visitor->user_id == $this->user_id)

        {

            return \XF::options()->sv_view_own_warnings;

        }
This isn't the correct fix. The issue is the warning action list and individual warning actions are not checking against the same user.

Should be fixed for the next release

2. When the checkbox in the option "Points and expiry time are editable when giving warning" is checked, the options "Warning Escalating Defaults" do not work correctly, do not increase the warning days by the number of points, if the options are disabled, then everything works correctly. Watch the video, I hope it will be clear, or ask clarifying questions.
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

При установке флажка в опции "Points and expiry time are editable when giving warning", некорректно работают опции "Warning Escalating Defaults", не увеличивают дни предупреждений на количество баллов, если опции отключить, то всё работает правильно. Смотрите видео, надеюсь будет понятно, или задайте уточняющие вопросы.
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Xenforo: v2.1.2
Mod's: Warning Improvements by Xon 2.2.12
PHP: 7.2.10
I'm not able to reproduce this. please check the console (network tab) to see what values are being sent to the browser as I suspect there may be some client-side scripting breaking things
 
I'm not able to reproduce this. please check the console (network tab) to see what values are being sent to the browser as I suspect there may be some client-side scripting breaking things
Everything is normal there, there are no errors.
 
Everything is normal there, there are no errors.
You need to verify what the expiry values are in the json retrieved when the browser hits the warning end-point to get warning details via ?fill=1

Try this with all other add-ons disabled, as this add-on updates the expiry value before it is sent to the browser.
 
Language barrier burdens communication🤷‍♂️

If I understand correctly, then you ask about it:

2019-07-03 22_27_37-Greenshot.jpg


I did not particularly delve into the essence of the error (there is no time for this).
Here’s how it looks in the getCategoryPoints function (but time is defined "above" by code, somewhere in other functions):
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

You need to verify what the expiry values are in the json retrieved when the browser hits the warning end-point to get warning details via ?fill=1
I apologize, I did not understand this phrase, how exactly should I use it?
If possible, set an example.
 
Last edited:
Language barrier burdens communication🤷‍♂️

If I understand correctly, then you ask about it:

View attachment 205802
Correct, those are the values you need to confirm are being changed as expected.

I did not particularly delve into the essence of the error (there is no time for this).
Here’s how it looks in the getCategoryPoints function (but time is defined "above" by code, somewhere in other functions):
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
This add-on extends XF\ControllerPlugin\Warn::getWarningFillerReply and adjusts the expiry duration by calling a custom function escalateDefaultExpirySettingsForUser and changing the definition response value which is used when populating formValues entries.

I apologize, I did not understand this phrase, how exactly should I use it?
If possible, set an example.
Please disable all other add-ons and see if the problem still occurs.
 
$input variable is empty:
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

I'll check later what you write :)
 
Please disable all other add-ons and see if the problem still occurs.
Disabled add-ons, nothing has changed.

UPD:
This add-on extends XF\ControllerPlugin\Warn::getWarningFillerReply and adjusts the expiry duration by calling a custom function escalateDefaultExpirySettingsForUser and changing the definition response value which is used when populating formValues entries.
thank.

You need to verify what the expiry values are in the json retrieved when the browser hits the warning end-point to get warning details via ?fill=1
Screenshot with the parameter ?fill=1 and disabled additions. Everything is OK there:
2019-07-04 05_11_23-Greenshot.webp
 
Last edited:
$input variable is empty:
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

I'll check later what you write :)
The $input variable should never be empty as getWarnSubmitInput returns a non-empty array.
 
The $input variable should never be empty as getWarnSubmitInput returns a non-empty array.
Sorry, wrong translation. Carefully look at the entire video (which I recorded last), how variables are defined in the $input array, and as a result it turns out over time.

I think for the data in the array $input you need to do an additional check, with filling in the correct data.
 
Last edited:
Top Bottom