From af49545e95a00f343a4041836639c58c2a59e212 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 2 Aug 2011 12:14:55 -0400 Subject: [PATCH] reduce the number of calls to get profile groups --- classes/Profile.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/classes/Profile.php b/classes/Profile.php index d0dad48d57..be60cfbd08 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -243,9 +243,14 @@ class Profile extends Memcached_DataObject function isMember($group) { - $gm = Group_member::pkeyGet(array('profile_id' => $this->id, - 'group_id' => $group->id)); - return (!empty($gm)); + $groups = $this->getGroups(0, null); + $gs = $groups->fetchAll(); + foreach ($gs as $g) { + if ($group->id == $g->id) { + return true; + } + } + return false; } function isAdmin($group)