]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
reduce the number of calls to get profile groups
authorEvan Prodromou <evan@status.net>
Tue, 2 Aug 2011 16:14:55 +0000 (12:14 -0400)
committerEvan Prodromou <evan@status.net>
Tue, 2 Aug 2011 16:14:55 +0000 (12:14 -0400)
classes/Profile.php

index d0dad48d57d7d7f97ce14e3abb3dce9d548b992c..be60cfbd082dc242f7ad25ed1797f6aee59ebd92 100644 (file)
@@ -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)