diff --git a/security/Member.php b/security/Member.php index 0a213b7e8..7be4274d0 100644 --- a/security/Member.php +++ b/security/Member.php @@ -882,7 +882,7 @@ class Member extends DataObject implements TemplateGlobalProvider { * @param string $groupcode */ public function removeFromGroupByCode($groupcode) { - $group = DataObject::get_one('Group', "\"Code\" = '" . Convert::raw2sql($groupcode). "'"); + $group = Group::get()->filter(array('Code' => $groupcode))->first(); if($group) { $this->Groups()->remove($group);