2018-02-18, 08:41 PM
https://community.mybb.com/thread-214294.html
This bug is similar to that one.
Example Bug:
Main Usergroup : Cannot warn users / maxwarningsperday 0
Secondary group: Can warn users / maxwarningsperday 3
User can give unlimited warnings.
Please confirm and fix.
EDIT: Btw I'm going to make a simple suggestion that eliminates a setting and could make things like this less buggy.
Remove the canwarnusers setting and use maxwarningsday with -1 as unlimited, 0 as cannot warn, and anything over 0 as the actual limit. In this way you simplify the code and remove a setting but achieve the same results. MyBB continues to use 0 as unlimited and I think that's a poor choice. Consider a better implementation.
This bug is similar to that one.
// Check we haven't exceeded the maximum number of warnings per day
if($mybb->usergroup['maxwarningsday'] != 0)
{
$timecut = TIME_NOW-60*60*24;
$query = $db->simple_select("warnings", "COUNT(wid) AS given_today", "issuedby='{$mybb->user['uid']}' AND dateline>'$timecut'");
$given_today = $db->fetch_field($query, "given_today");
if($given_today >= $mybb->usergroup['maxwarningsday'])
{
error($lang->sprintf($lang->warnings_reached_max_warnings_day, $mybb->usergroup['maxwarningsday']));
}
}
Example Bug:
Main Usergroup : Cannot warn users / maxwarningsperday 0
Secondary group: Can warn users / maxwarningsperday 3
User can give unlimited warnings.
Please confirm and fix.
EDIT: Btw I'm going to make a simple suggestion that eliminates a setting and could make things like this less buggy.
Remove the canwarnusers setting and use maxwarningsday with -1 as unlimited, 0 as cannot warn, and anything over 0 as the actual limit. In this way you simplify the code and remove a setting but achieve the same results. MyBB continues to use 0 as unlimited and I think that's a poor choice. Consider a better implementation.