reduce the number of calls to get profile groups
This commit is contained in:
parent
58d798b607
commit
af49545e95
|
@ -243,9 +243,14 @@ class Profile extends Memcached_DataObject
|
||||||
|
|
||||||
function isMember($group)
|
function isMember($group)
|
||||||
{
|
{
|
||||||
$gm = Group_member::pkeyGet(array('profile_id' => $this->id,
|
$groups = $this->getGroups(0, null);
|
||||||
'group_id' => $group->id));
|
$gs = $groups->fetchAll();
|
||||||
return (!empty($gm));
|
foreach ($gs as $g) {
|
||||||
|
if ($group->id == $g->id) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isAdmin($group)
|
function isAdmin($group)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user