diff --git a/src/Pages/MemberProfileViewer.php b/src/Pages/MemberProfileViewer.php index 8c4c8f2b..08faafcf 100644 --- a/src/Pages/MemberProfileViewer.php +++ b/src/Pages/MemberProfileViewer.php @@ -47,7 +47,12 @@ public function __construct($parent, $name) { */ public function handleList($request) { $fields = $this->parent->Fields()->filter('MemberListVisible', true); - $members = $this->parent->Groups()->relation('Members'); + + $groups = $this->parent->Groups(); + if($groups->Count()) { + // todo: this ->relation method does not seem to work: no Members are found + $members = $groups->relation('Members'); + } else $members = Member::get(); $members = new PaginatedList($members, $request); $list = new PaginatedList(new ArrayList(), $request); @@ -109,7 +114,7 @@ public function handleView($request) { $member = Member::get()->byID($id); $groups = $this->parent->Groups(); - if(!$member->inGroups($groups)) { + if($groups->Count() && !$member->inGroups($groups)) { $this->httpError(403); }