make Profile::isMember() and Profile::isAdmin() use caching pkeyGet()
This commit is contained in:
parent
402c0654ea
commit
29243cd21a
|
@ -211,31 +211,16 @@ class Profile extends Memcached_DataObject
|
|||
|
||||
function isMember($group)
|
||||
{
|
||||
$mem = new Group_member();
|
||||
|
||||
$mem->group_id = $group->id;
|
||||
$mem->profile_id = $this->id;
|
||||
|
||||
if ($mem->find()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$gm = Group_member::pkeyGet(array('profile_id' => $this->id,
|
||||
'group_id' => $group->id));
|
||||
return (!empty($gm));
|
||||
}
|
||||
|
||||
function isAdmin($group)
|
||||
{
|
||||
$mem = new Group_member();
|
||||
|
||||
$mem->group_id = $group->id;
|
||||
$mem->profile_id = $this->id;
|
||||
$mem->is_admin = 1;
|
||||
|
||||
if ($mem->find()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$gm = Group_member::pkeyGet(array('profile_id' => $this->id,
|
||||
'group_id' => $group->id));
|
||||
return (!empty($gm) && $gm->is_admin);
|
||||
}
|
||||
|
||||
function isPendingMember($group)
|
||||
|
|
Loading…
Reference in New Issue
Block a user