From: Evan Prodromou Date: Tue, 2 Aug 2011 16:14:55 +0000 (-0400) Subject: reduce the number of calls to get profile groups X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=af49545e95a00f343a4041836639c58c2a59e212;p=quix0rs-gnu-social.git reduce the number of calls to get profile groups --- 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)