MyBB Community Forums

Full Version: Duplicated moderator entry in forumdisplay
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
And here we go again:
I have a forum , for example named "Parent" and a child forum in this forum for example named "Child" .
Now If I make someone moderator on both forum and its subforum ("Parent" & "Child"),
His name will appear 2 times in the moderators section of forumdisplay for "Child" !
Hi johny,
I believe that once you add a moderator to a parent forum, the permissions flow down to the child forums, so there is no need to make someone a moderator for a parent and child forum.
Mistake:
the duplication exists for child forum ,not parent. and original post edited.
Quote:Hi johny,
I believe that once you add a moderator to a parent forum, the permissions flow down to the child forums, so there is no need to make someone a moderator for a parent and child forum.
I need diffrent permissions for parent and child forums so I must make him moderator in both.
In forumdisplay.php, find:
$modcomma = '';
$modlist = '';
$parentlistexploded = explode(",", $parentlist);
foreach($parentlistexploded as $mfid)
{
	if($moderatorcache[$mfid])
	{
		reset($moderatorcache[$mfid]);
		foreach($moderatorcache[$mfid] as $moderator)
		{
			$moderator['username'] = format_name($moderator['username'], $moderator['usergroup'], $moderator['displaygroup']);
			eval("\$modlist .= \"".$templates->get("forumdisplay_moderatedby_moderator", 1, 0)."\";");
			$modcomma=", ";
		}
	}
}
Replace with:
$modcomma = '';
$modlist = '';
		foreach($moderatorcache[$fid] as $moderator)
		{
			$moderator['username'] = format_name($moderator['username'], $moderator['usergroup'], $moderator['displaygroup']);
			eval("\$modlist .= \"".$templates->get("forumdisplay_moderatedby_moderator", 1, 0)."\";");
			$modcomma=", ";
		}
	}
In inc/functions.php, find:
		if(!$parentslist)
		{
			$parentslist = get_parent_list($fid);
		}
		
		$sql = build_parent_list($fid, "fid", "OR", $parentslist);
		$query = $db->simple_select(TABLE_PREFIX."moderators", "*", "uid='{$uid}' AND {$sql}");
		$perms = $db->fetch_array($query);
		$modpermscache[$fid][$uid] = $perms;
Replace with:
		$query = $db->simple_select(TABLE_PREFIX."moderators", "*", "uid='{$uid}' AND fid='{$fid}'");
		$perms = $db->fetch_array($query);
		$modpermscache[$fid][$uid] = $perms;


That should eliminate moderator inheritance (ignore the inherited moderators in the Admin CP)
thank you