jdarwood007 commited on 2016-12-26 13:30:31
Showing 1 changed files, with 15 additions and 17 deletions.
Signed-off-by: jdarwood007 <unmonitored+github@sleepycode.com>
... | ... |
@@ -262,6 +262,20 @@ function shd_stats_totals() |
262 | 262 |
{ |
263 | 263 |
global $smcFunc; |
264 | 264 |
|
265 |
+ // Count Admins separately for now.! |
|
266 |
+ $admins = array(); |
|
267 |
+ $request = $smcFunc['db_query']('', ' |
|
268 |
+ SELECT id_member |
|
269 |
+ FROM {db_prefix}members |
|
270 |
+ WHERE id_group = {int:admin} OR FIND_IN_SET({int:admin}, additional_groups)', |
|
271 |
+ array( |
|
272 |
+ 'admin' => 1 |
|
273 |
+ )); |
|
274 |
+ |
|
275 |
+ while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
276 |
+ $admins[] = $row['id_member']; |
|
277 |
+ $smcFunc['db_free_result']($request); |
|
278 |
+ |
|
265 | 279 |
// @TODO: This most likely will filesort and be slow on large helpdesks. |
266 | 280 |
$request = $smcFunc['db_query']('', ' |
267 | 281 |
SELECT COUNT(mem.id_member) AS count, hdr.template |
... | ... |
@@ -285,25 +299,9 @@ function shd_stats_totals() |
285 | 299 |
$totals[$row['template']] = $row['count']; |
286 | 300 |
$smcFunc['db_free_result']($request); |
287 | 301 |
|
288 |
- // Count Admins separately for now.! |
|
289 |
- $admins = array(); |
|
290 |
- if (empty($totals[ROLE_ADMIN])) |
|
291 |
- { |
|
292 |
- $request = $smcFunc['db_query']('', ' |
|
293 |
- SELECT id_member |
|
294 |
- FROM {db_prefix}members |
|
295 |
- WHERE id_group = {int:admin} OR FIND_IN_SET({int:admin}, additional_groups)', |
|
296 |
- array( |
|
297 |
- 'admin' => 1 |
|
298 |
- )); |
|
299 |
- |
|
300 |
- while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
301 |
- $admins[] = $row['id_member']; |
|
302 |
- $smcFunc['db_free_result']($request); |
|
303 |
- |
|
304 | 302 |
// Add in the admins. |
303 |
+ if (empty($totals[ROLE_ADMIN])) |
|
305 | 304 |
$totals[ROLE_ADMIN] += count($admins); |
306 |
- } |
|
307 | 305 |
|
308 | 306 |
return $totals; |
309 | 307 |
} |
310 | 308 |