Skip to content

Commit

Permalink
fixed: improved performance of users/group_bundled query
Browse files Browse the repository at this point in the history
  • Loading branch information
jeabakker committed Aug 7, 2023
1 parent 5986234 commit 58eef51
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions views/json/advanced_statistics/admin/users/groups_bundled.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
];

if (!(bool) elgg_extract('include_banned_users', $vars, true)) {
$md2 = $qb->joinMetadataTable('r', 'guid_one', 'banned');
$qb->andWhere($qb->compare("{$md2}.value", '=', 'no', ELGG_VALUE_STRING));
$banned = $qb->subquery('metadata');
$banned->select('entity_guid')
->where($qb->compare('name', '=', 'banned', ELGG_VALUE_STRING))
->andWhere($qb->compare('value', '=', 'yes', ELGG_VALUE_STRING));

$qb->andWhere($qb->compare('r.guid_one', 'NOT IN', $banned->getSQL()));

$base_options['metadata_name_value_pairs'][] = [
'name' => 'banned',
Expand Down

0 comments on commit 58eef51

Please sign in to comment.