Skip to content

Commit

Permalink
! fix#2192 local moderators were not reported properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Spuds committed Aug 27, 2015
1 parent 860faa5 commit 1478f04
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
15 changes: 9 additions & 6 deletions sources/admin/Reports.controller.php
Expand Up @@ -165,9 +165,11 @@ public function action_boards()

// Get every moderator.
$moderators = allBoardModerators();

$boards_moderated = array();
foreach ($moderators as $id_member => $row)
$boards_moderated[$id_member][] = $row['id_board'];
foreach ($moderators as $id_board => $rows)
foreach ($rows as $row)
$boards_moderated[$id_board][] = $row['real_name'];

// Get all the possible membergroups!
$all_groups = getBasicMembergroupData(array('all'), array(), null, false);
Expand Down Expand Up @@ -568,11 +570,12 @@ public function action_staff()

// Fetch all the board names.
$boards = fetchBoardsInfo('all');
$moderators = allBoardModerators();
$moderators = allBoardModerators(true);
$boards_moderated = array();

foreach ($moderators as $id_member => $row)
$boards_moderated[$id_member][] = $row['id_board'];
foreach ($moderators as $id_member => $rows)
foreach ($rows as $row)
$boards_moderated[$id_member][] = $row['id_board'];

// Get a list of global moderators (i.e. members with moderation powers).
$global_mods = array_intersect(membersAllowedTo('moderate_board', 0), membersAllowedTo('approve_posts', 0), membersAllowedTo('remove_any', 0), membersAllowedTo('modify_any', 0));
Expand Down Expand Up @@ -630,7 +633,7 @@ public function action_staff()
// Get the names
foreach ($boards_moderated[$row['id_member']] as $board)
if (isset($boards[$board]))
$staffData['moderates'][] = $boards[$board];
$staffData['moderates'][] = $boards[$board]['name'];

$staffData['moderates'] = implode(', ', $staffData['moderates']);
}
Expand Down
10 changes: 8 additions & 2 deletions sources/subs/Boards.subs.php
Expand Up @@ -1567,7 +1567,8 @@ function getBoardModerators($idboard, $only_id = false)
* Get a list of all the board moderators (every board)
*
* @package Boards
* @param bool $only_id return only the id of the moderators instead of id and name (default false)
* @param bool $only_id return array with key of id_member of the moderator(s)
* otherwise array with key of id_board id (default false)
* @return array
*/
function allBoardModerators($only_id = false)
Expand All @@ -1593,7 +1594,12 @@ function allBoardModerators($only_id = false)
);

while ($row = $db->fetch_assoc($request))
$moderators[$row['id_member']] = $row;
{
if ($only_id)
$moderators[$row['id_member']][] = $row;
else
$moderators[$row['id_board']][] = $row;
}
$db->free_result($request);

return $moderators;
Expand Down
5 changes: 3 additions & 2 deletions sources/subs/ScheduledTask.class.php
Expand Up @@ -128,8 +128,9 @@ public function approval_notification()

// Make sure they get included in the big loop.
$members = array_keys($all_mods);
foreach ($all_mods as $row)
$mods[$row['id_member']][$row['id_board']] = true;
foreach ($all_mods as $id_member => $rows)
foreach ($rows as $row)
$mods[$id_member][$row['id_board']] = true;
}

// Come along one and all... until we reject you ;)
Expand Down

0 comments on commit 1478f04

Please sign in to comment.