! [Staff List] If site admins are not allowed to be assigned tickets, they shouldn't really be listed as staff. (Like SD's core check for assignment, the criteria is not is-helpdesk-admin but is-pure-forum-admin in this case.) [Bug 686]
gruffen

gruffen commited on 2011-05-30 16:55:15
Showing 1 changed files, with 20 additions and 1 deletions.

... ...
@@ -69,7 +69,7 @@ function shd_staff_list_main_menu(&$menu_buttons)
69 69
 // This is where the magic happens!
70 70
 function shd_staff_list()
71 71
 {
72
-	global $context, $txt, $modSettings, $scripturl, $sourcedir, $memberContext, $settings, $options;
72
+	global $context, $txt, $modSettings, $smcFunc, $scripturl, $sourcedir, $memberContext, $settings, $options;
73 73
 	
74 74
 	shd_is_allowed_to('shd_staff_list_view');
75 75
 
... ...
@@ -77,6 +77,25 @@ function shd_staff_list()
77 77
 	$context['sub_template'] = 'shd_staff_list';
78 78
 	
79 79
 	$get_members = shd_members_allowed_to('shd_staff');
80
+	// Are site admins eligible for receiving tickets?
81
+	if (!empty($modSettings['shd_admins_not_assignable']))
82
+	{
83
+		$query = $smcFunc['db_query']('', '
84
+			SELECT id_member
85
+			FROM {db_prefix}members
86
+			WHERE id_group = 1
87
+				OR FIND_IN_SET(1, additional_groups)',
88
+			array()
89
+		);
90
+
91
+		$admins = array();
92
+		while ($row = $smcFunc['db_fetch_row']($query))
93
+			$admins[] = $row[0];
94
+
95
+		$smcFunc['db_free_result']($query);
96
+		$get_members = array_diff($get_members, $admins);
97
+	}
98
+
80 99
 	$context['staff_members'] = array();
81 100
 	loadMemberData($get_members);
82 101
 	
83 102