Bladeren bron

! And also update the edit-membergroup area to cover the whole board access thing. Per #1196

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 10 jaren geleden
bovenliggende
commit
68fa7bc534

+ 18 - 0
Sources/ManageMembergroups.php

@@ -661,6 +661,11 @@ function EditMembergroup()
 	if (empty($_REQUEST['group']))
 		fatal_lang_error('membergroup_does_not_exist', false);
 
+	// People who can manage boards are a bit special.
+	require_once($sourcedir . '/Subs-Members.php');
+	$board_managers = groupsAllowedTo('manage_boards', null);
+	$context['can_manage_boards'] = in_array($_REQUEST['group'], $board_managers['allowed']);
+
 	// Can this group moderate any boards?
 	$request = $smcFunc['db_query']('', '
 		SELECT COUNT(id_board)
@@ -753,6 +758,19 @@ function EditMembergroup()
 		if ($_REQUEST['group'] == 2 || $_REQUEST['group'] > 3)
 		{
 			$accesses = empty($_POST['boardaccess']) || !is_array($_POST['boardaccess']) ? array() : $_POST['boardaccess'];
+
+			// If they can manage boards, the rules are a bit different. They can see everything.
+			if ($context['can_manage_boards'])
+			{
+				$accesses = array();
+				$request = $smcFunc['db_query']('', '
+					SELECT id_board
+					FROM {db_prefix}boards');
+				while ($row = $smcFunc['db_fetch_assoc']($request))
+					$accesses[(int) $row['id_board']] = 'allow';
+				$smcFunc['db_free_result']($request);
+			}
+
 			$changed_boards['allow'] = array();
 			$changed_boards['deny'] = array();
 			$changed_boards['ignore'] = array();

+ 5 - 1
Themes/default/ManageMembergroups.template.php

@@ -315,7 +315,11 @@ function template_edit_group()
 							<span class="smalltext">' . $txt['membergroups_new_board_post_groups'] . '</span>' : '', '
 						</dt>
 						<dd>';
-		template_add_edit_group_boards_list();
+		if (!empty($context['can_manage_boards']))
+			echo $txt['membergroups_can_manage_access'];
+		else
+			template_add_edit_group_boards_list();
+
 		echo '
 						</dd>';
 	}

+ 1 - 0
Themes/default/languages/ManageMembers.english.php

@@ -24,6 +24,7 @@ $txt['membergroups_new_as_type'] = 'by type';
 $txt['membergroups_new_as_copy'] = 'based off of';
 $txt['membergroups_new_copy_none'] = '(none)';
 $txt['membergroups_can_edit_later'] = 'You can edit them later.';
+$txt['membergroups_can_manage_access'] = 'This group can see all boards because they have the power to manage boards.';
 
 $txt['membergroups_cannot_delete_paid'] = 'This group cannot be deleted, it is currently in use by the following paid subscription(s): %1$s';