MyBB Community Forums

Full Version: [F] [MCP] - moderators cant mark reported posts in child forums [C-Chris]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
MyBB 1.4.2

User which is a moderator of a category cannot mark reported posts for his child forums. It is because of:
file: modcp.php
// SQL for fetching items only related to forums this user moderates
$moderated_forums = array();
if($mybb->usergroup['issupermod'] != 1)
{
	$query = $db->simple_select("moderators", "*", "uid='{$mybb->user['uid']}'");
and resulting variable $flist have only fids of categories, not all child forums. This variable $flist is used in update query:
$db->update_query("reportedposts", array('reportstatus' => 1), "rid IN ({$rids}){$flist}");



A possible fix:
FIND:
// SQL for fetching items only related to forums this user moderates
$moderated_forums = array();
if($mybb->usergroup['issupermod'] != 1)
{
	$query = $db->simple_select("moderators", "*", "uid='{$mybb->user['uid']}'");
	while($forum = $db->fetch_array($query))
	{
		$flist .= ",'{$forum['fid']}'";
		$moderated_forums[] = $forum['fid'];
	}
REPLACE WITH:
// SQL for fetching items only related to forums this user moderates
$moderated_forums = array();
if($mybb->usergroup['issupermod'] != 1)
{
	$mc_moderators_cache = $cache->read("moderators");
	foreach($mc_moderators_cache as $mc_fid => $mc_moderators)
	{
		if ($mc_fid and is_array($mc_moderators))
		{
			if (array_key_exists($mybb->user['uid'], $mc_moderators))
			{
				$flist .= ",'$mc_fid'";
				$moderated_forums[] = $mc_fid;
			}
		}
	}
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group
In modcp.php find:

$flist .= ",'{$forum['fid']}'";

add after

$children = get_child_list($forum['fid']);
if(!empty($children))
{
	$flist .= ",'".implode("','", $children)."'";
}