MyBB Community Forums

Full Version: Removing moderator on forum is reseting gid
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
Quote:When MyBB removes the user as a moderator, it should only remove the moderator usergroup. Is this not how the functionality is currently working?

No because the moderator is reverted to group 2 even if they weren't originally. My solution 100% fixes all problems except maybe if the user wants it as display group and they would need to go into usercp.

I believe some well detailed example of problems with current implementation are posted. Hope you take the time to read them as I believe it will sort out what's happening.

Moderator is not like banned where you want any privs revoked. You want as a moderator that any assigned custom group permissions are still kept.

I'll try to explain again but I believe I am only repeating an earlier post.

1. Create custom group (9).
2. Group 9 can access a new category along with 3 forums (a,b,c) but group 2 has no permission
3. Assign a moderator to forum B.
4. Permission to see forum A and forum C was just revoked.

To fix simple set the moderator group as an additional usergroup. This has no ill effects on function. The forum list still shows moderator and all mod permissions work as it's based of the table mybb_moderators.

When moderator is removed my fix simply deletes the forum moderaors additionalusergroup as long as they are not a forum moderator in another group. I tested my fix in what I believe to be any scenario.
I don't like that fix. If you are set as a moderator it should show up in such as in the usergroup. Your removing/breaking (depending on who you speak to) functionality with your fix, by putting it in the additional group column versus the usergroup column.

The issue is that MyBB doesn't log a history of usergroup changes and is able to revert back to one in the history. MyBB will probably never keep a history like that.

As such, I am marking this as bogus as a Limitation in the MyBB Software. Feel free to file a suggestion in the Suggestions Forum.
You missed the whole concept of why this is a problem.

Quote:The issue is that MyBB doesn't log a history of usergroup changes and is able to revert back to one in the history

Realistically that's not the problem at all.

Quote:As such, I am marking this as bogus as a Limitation in the MyBB Software.

I would think that fixing a limitation would be important.

Quote:Feel free to file a suggestion in the Suggestions Forum.

I am sure I will get the "maybe in the future" response especially given how this thread has gone.

Oh well...I wrote my own fix..I'll just have to use it. It's a rare core file change for me. It's my second one now. I hope this doesn't continue because being forced to make core file changes is why I left phpbb and VB. I would make my changes as a plugin but the needed hooks are not in place. Both hooks are after the damage is done.

Well thanks anyways Ryan. I did my best to convince but ultimately I'll just deal with this on my own. I have the fix posted is anyone wants to use it. I only ask that you chime in this thread and show support for an official change.
Yeah, I also left phpBB for the same reason, too much to break if a code edit goes wrong. I'd like that fix too.
The fixed file is on page 2 of this thread.

http://community.mybboard.net/attachment.php?aid=14670

Just make sure if that file is changed on any upgrades and what changes have occurred. You can PM if it does and I will update the changes. I might have to go make a suggestion and see what kind of response I can get there.
(2009-07-20, 06:23 AM)labrocca Wrote: [ -> ]You missed the whole concept of why this is a problem.

Quote:The issue is that MyBB doesn't log a history of usergroup changes and is able to revert back to one in the history

Realistically that's not the problem at all.

Realistically, I don't want a half-assed solution. Realistically, your fix only changes functionality, not fixes it. Realistically, I will end up getting 10 bug reports with you fix, complaining about not showing a moderator as a moderator as their usergroup. Realistically, the only good solution is to track the previous usergroup the user had, which is realistically not a good enough reason for me to add, for 1 line of code in MyBB. Realistically, adding usergroup tracking is an entire feature, and as such wouldn't be something I would add in a maintenance release.

(2009-07-20, 06:23 AM)labrocca Wrote: [ -> ]
Quote:As such, I am marking this as bogus as a Limitation in the MyBB Software.

I would think that fixing a limitation would be important.

Limitations and bugs are different. Limitation like the speed limit on freeways. Bugs as in a broken stoplight at an intersection.

(2009-07-20, 06:23 AM)labrocca Wrote: [ -> ]I hope this doesn't continue because being forced to make core file changes is why I left phpbb and VB.

It's your choice about which software you want to run. There will always be limitations. If you want those limits removed, then your going to have to deal with it.

(2009-07-20, 06:23 AM)labrocca Wrote: [ -> ]I would make my changes as a plugin but the needed hooks are not in place. Both hooks are after the damage is done.

You could create a plugin if you wanted, without any modification changes.

In the install function create a new usergroup tracking column in the users table.

With the "admin_forum_management_deletemod" hook:

global $tracking_usergroup, $db, $mybb;

$query = $db->simple_select("moderators", "*", "uid='{$mybb->input['uid']}' AND fid='{$mybb->input['fid']}'");
$mod = $db->fetch_array($query);

$query = $db->simple_select("users", "tracking_usergroup_field", "uid='{$mod['uid']}'");
$tracking_usergroup = $db->fetch_field($query, "tracking_usergroup_field");

With the "admin_forum_management_deletemod_commit" field:

global $mod, $tracking_usergroup, $cache, $db;

$query = $db->simple_select("moderators", "*", "uid='{$mod['uid']}'");
if($db->num_rows($query) == 0)
{
	$updatequery = array(
		"usergroup" => $tracking_usergroup,
		"tracking_usergroup" => 0,
	);
	$db->update_query("users", $updatequery, "uid='{$mod['uid']}'");
}

with the "admin_forum_management_start" hook:

global $tracking_usergroup, $mybb, $db;
if($mybb->input['add'] == "moderators")
{
	$query = $db->simple_select("users", "usergroup", "username='".$db->escape_string($mybb->input['username'])."'", array('limit' => 1));
	$tracking_usergroup = $db->fetch_field($query, "usergroup");
}

With the "admin_forum_management_start_moderators_commit" hooks:

global $tracking_usergroup, $db, $cache;

$db->update_query("users", array('tracking_usergroup_field' => intval($tracking_usergroup)), "uid='{$user['uid']}' AND usergroup='6'");

(2009-07-20, 06:23 AM)labrocca Wrote: [ -> ]I only ask that you chime in this thread and show support for an official change.

As I said, your fix changes some unwanted functionality to be better, but also changes some wanted functionality to be unwanted functionality. A trade-off fix, is not a fix I am going to lightly implement for MyBB, especially for such a small issue as this.

Ryan
Quote:Realistically, I will end up getting 10 bug reports with you fix, complaining about not showing a moderator as a moderator as their usergroup.

That's your only valid complaint and negative possibility about my fix. But the same could be said about a lot of features or behaviors in Mybb. The bogus bug report section is filled with them.

Because something isn't a bug but instead a bad behavior doesn't mean it shouldn't be fixed.

Quote:the only good solution is to track the previous usergroup the user had

That statement shows me you still don't get what this bug is about. If you had custom usergroups that had special permissions you would understand the problems with forum moderators as they are. Your fixes don't fix the problem of a usergroup being overwritten. That's the issue here.

I also saw the hooks. There is a problem when removing the moderator. The group is deleted and then you can't I have to see if I can look again. If I can do this with a plugin then of course that's more than acceptable to me.

EDIT: Attached is a plugin to deal with this issue. I had to find a workaround but I finally nailed it.
(2009-07-20, 11:22 PM)labrocca Wrote: [ -> ]
Quote:Realistically, I will end up getting 10 bug reports with you fix, complaining about not showing a moderator as a moderator as their usergroup.

That's your only valid complaint and negative possibility about my fix. But the same could be said about a lot of features or behaviors in Mybb. The bogus bug report section is filled with them.

Some changes are worth it, some are not. As I said, this is a very very small issue and not worth any change to the functionality especially if the fix breaks other intended functionality.

(2009-07-20, 11:22 PM)labrocca Wrote: [ -> ]
Quote:the only good solution is to track the previous usergroup the user had

That statement shows me you still don't get what this bug is about. If you had custom usergroups that had special permissions you would understand the problems with forum moderators as they are. Your fixes don't fix the problem of a usergroup being overwritten. That's the issue here.

The topic title of this bug report is "Removing". Clearly, if I don't understand it, then neither does the person who reported it. Contradictory bug reports don't help. Be Clear and concise from the start, otherwise you'll just end up confusing people.
As you say...the person who reported it. That wasn't me. He didn't understand the behavior or why it happened so maybe neither do you. However I do as I have experienced it myself.

It's all good though. Whenever I can make a plugin only alteration I am happy. I hope though in 2.0 the forum moderators are reconsidered...the entire group thing is imho a bit iffy. We have usergroup,additionalgroups, and displaygroup. I can be to some confusing. I have just worked around it as best I can but as I use custom groups more and more I find little quirks in the system.

Right now I have 26 total groups. Each is needed and I have special permissions all over the place.
Take it easy. Both of you have right. labrocca understand me like I want to be understand. Sorry for my bad english, so sometimes is hard to say, what I mean.
Anyway - I like labrocca's fix and have hope this solution (or similar) will be implemented on next core version of MyBB.
Pages: 1 2 3 4 5