Bug #556
Wrong additional groups in ACP
| Status: | Closed | Start date: | 12/02/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | Ryan Gordon | % Done: | 100% |
|
| Category: | Admin Control Panel | |||
| Target version: | 1.4.12 | |||
| Reproducibility: | Always | Database Type: | ||
| Reported In MyBB Version: | 1.4.10 | Database Version: | ||
| PHP Version: | SQA assignments: | |||
| Browser: |
Description
Sometimes you can't set additional groups as you want.
In admin/modules/user/users.php (571):
foreach($mybb->input['additionalgroups'] as $gid)
{
if($gid == $mybb->input['usergroup'])
{
unset($mybb->input['additionalgroups'][$gid]);
}
}
Above code doesn't have much sense. Example fix:
foreach($mybb->input['additionalgroups'] as $i=>$gid)
{
if($gid == $mybb->input['usergroup'])
{
unset($mybb->input['additionalgroups'][$i]);
}
}
Associated revisions
Fixes Wrong additional groups in ACP (fixes:556)
History
Updated by Matt Rogowski about 2 years ago
Would you possibly be able to explain how you can't set them 'as you want'?? We can't reproduce the problem if you don't tell us what is actually happening.
Updated by Tomasz Gruca about 2 years ago
When you set additional groups there should not be your primary group - when you check you primary group too it should be unchecked during update. At least the quoted code was ment to do so. But it's buggy and does completely different thing. Let's say, your primary group is 2=Registered. Now when you check Registered in additional groups it won't be unchecked but instead the 3rd group checked will be unchecked (no matter what it is). Just see the code - it tests something with if() and unsets something completely different.
Maybe I wasn't precise enough. You can set what you wan't if you remember not to add your primary group in additional groups. But imagine when you just change your primary group (which was in additional groups earlier) - you would be really confused to see that what you just checked in additional groups isn't there and next updates just mess up more.
Updated by Ryan Gordon about 2 years ago
- Status changed from New to Assigned
- Assignee set to Ryan Gordon
- Target version set to 1.6.0 Beta
I see where the logic in the code messed up. Yes, this should be fixed.
Updated by Ryan Gordon about 2 years ago
- Status changed from Assigned to Resolved
- % Done changed from 0 to 100
Applied in changeset r4593.
Updated by Ryan Gordon about 2 years ago
- Target version changed from 1.6.0 Beta to 1.4.12
Updated by Chris W. B. about 2 years ago
- Status changed from Resolved to Closed