Skip to content

Commit

Permalink
Allow working without any Group, just showing all Members in the List
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisDebonnet committed Feb 27, 2018
1 parent 906280d commit ae27af9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Pages/MemberProfileViewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit ae27af9

Please sign in to comment.