reduce the number of calls to get profile groups

This commit is contained in:
Evan Prodromou 2011-08-02 12:14:55 -04:00
parent 58d798b607
commit af49545e95

View File

@ -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)