[Duplicate] Predefined warnings aren't stored with their warning type
I didn't see that one before. So I tested it and it does not fix the actual problem, just obscure it.

Here is a test setup I used with the latest version with that fix linked in your thread:

First, two warnings are defined

[Image: 2014-12-04_18-59-42-1CBhBZ.png]

These warnings have the "tid" 15 and 16 respectively, as seen here in the database:

[Image: 2014-12-04_19-08-59-C4emR5.png]

Now I attempt to give a warning for a post with post id 492 which happens to be in the thread with the thread id 16. So I enter the warning. I choose the smaller warning, which has warning type id 15 as seen before in the database:

[Image: 2014-12-04_19-02-30-RQGcuA.png]

The expected result would be, that the user has now been warned with 10 points for 1 month and the reason "This is the intended warning".

The actual outcome is this:

[Image: 2014-12-04_19-03-26-DzAMlU.png]

[Image: 2014-12-04_19-03-41-JOI12b.png]

As you can see, the text is wrong, but everything else is correct. Where does the text come from? In the database, the warning looks like this:

[Image: 2014-12-04_19-40-28-IXxDav.png]

As explained before, currently and even after the patch linked above, the field "tid" is filled with the thread id (in case of warnings for posts), not the warning type id, which is wrong. It doesn't even matter that we do set the correct warning text now additionally for every warning (thanks to the patch from above), because if there is a warning type that coincidentially matches the thread id, that warning text will be used instead.

I'll open a pull request with these changes on github for you.

Edit: Here it is: https://github.com/mybb/mybb/pull/1677

Messages In This Thread
RE: Predefined warnings aren't stored with their warning type - by Evenprime - 2014-12-04, 06:44 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)