Commit b5403b6a authored by mattwire's avatar mattwire
Browse files

Fix when logged in user has no admin groups

parent 5443f072
......@@ -30,25 +30,25 @@ class CRM_Groupadmin_BAO_GroupAdminContact extends CRM_Groupadmin_DAO_GroupAdmin
SELECT contact_id FROM civicrm_group_contact WHERE group_id IN ('
. implode(',', self::getGroupAdminList($contactID)) . ')
)';
}
$smartGroups = \Civi\Api4\Group::get()
->addSelect('id')
->addWhere('saved_search_id', 'IS NOT NULL')
->addWhere('id', 'IN', $groups)
->setCheckPermissions(FALSE)
->execute()
->indexBy('id');
$smartGroups = \Civi\Api4\Group::get()
->addSelect('id')
->addWhere('saved_search_id', 'IS NOT NULL')
->addWhere('id', 'IN', $groups)
->setCheckPermissions(FALSE)
->execute()
->indexBy('id');
if ($smartGroups->count() > 0) {
$smartGroupIDs = array_keys($smartGroups->getArrayCopy());
// Check and refresh smartgroup cache
\CRM_Contact_BAO_GroupContactCache::check($smartGroupIDs);
if ($smartGroups->count() > 0) {
$smartGroupIDs = array_keys($smartGroups->getArrayCopy());
// Check and refresh smartgroup cache
\CRM_Contact_BAO_GroupContactCache::check($smartGroupIDs);
$where[] = 'contact_a.id IN (
$where[] = 'contact_a.id IN (
SELECT contact_id FROM civicrm_group_contact_cache WHERE group_id IN ('
. implode(',', $smartGroupIDs) . ')
. implode(',', $smartGroupIDs) . ')
)';
}
}
return implode(' OR ', $where);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment