[solved] Bug in UserList filterByGroup?

Permalink
Hi everyone

a short question:
Is there an error in sorting the userlist by group in concrete5 version 8.4.4?

Example:
I have a user group "Test" and below a subgroup "Test Level 2"
A user is assigned to the group "Test Level 2".

In my own singelpage controller I simply use the example from the developer documentation:
public function view(){
      $uList = new \Concrete\Core\User\UserList();
      $uGroup = \Group::getByName('Test Level 2');
      $uList->filterByGroup($group);
      ...
    }


In the last line of code, however, he runs on an error:

Call to a member function getGroupPath() on null
htdocs\concrete5\concrete\src\User\UserList.php
335.           $orX->add($this->getQueryObject()->expr()->like('g.gPath', "'" . $group->getGroupPath() . "/%'"));


The $uGroup object looks correctly filled for me:
...
public 'gID' => string '57'
public 'gName' => string 'Test Level 2'
public 'gPath' => string '/Test/Test Level 2'
...


Have I forgotten something in the code or is there a bug?
Can anyone help me?
Thanks and greetings

LennDa
 
mhawke replied on at Permalink Best Answer Reply
mhawke
At first blush there appears to be a small typo. The third line of your view() function should read
$uList->filterByGroup($uGroup);


'$uGroup' instead of '$group'
LennDa replied on at Permalink Reply
LennDa
thx