Filtering groups in the members page
Permalink
Hi,
Once you have your members listed in the members page, how do you filter them by group ala Users and Groups or the concrete5.org website.
Is there some kind of search facility checkbox arrangement type thing that will do the filtering and sorting?
Nige
Once you have your members listed in the members page, how do you filter them by group ala Users and Groups or the concrete5.org website.
Is there some kind of search facility checkbox arrangement type thing that will do the filtering and sorting?
Nige
Hi and thanks for your reply.
This is what I am after and thanks a lot.
Unfortunately Im not a coder but I can follow instructions and this looks to be possible for me.
I just want to be able to filter out the members according to their group designation.
If you do have the code I would appreciate that if it is a bit tricky. Also exactly where to stick it.
Also you mention stick in a combo box. Where do I get an instant combo box, is there an addon?
Nige
This is what I am after and thanks a lot.
Unfortunately Im not a coder but I can follow instructions and this looks to be possible for me.
I just want to be able to filter out the members according to their group designation.
If you do have the code I would appreciate that if it is a bit tricky. Also exactly where to stick it.
Also you mention stick in a combo box. Where do I get an instant combo box, is there an addon?
Nige
This is the code I would use - did not test but im pretty sure it will work.
in the /concrete5/single_pages/members.php After the line
add the code below following this line
Then in /concrete5/controllers/members.php Repace this block
With
Let me know if you have any more questions, or if you can not get it to work I will test for myself.
in the /concrete5/single_pages/members.php After the line
<input name="keywords" type="text" value="<?php echo $keywords?>" size="20" />
add the code below following this line
<?php $db = Loader::db(); $query = "SELECT gID, gName FROM Groups"; $result = $db->Execute($query); ?> <select name="group"> <option value=""></option> <?php while($row=$result->fetchRow()) { $gID = $row['gID']; $gName = $row['gName']; ?><option value="<?php echo $gID?>"><?php echo $gName?></option><?php } ?> </select>
Then in /concrete5/controllers/members.php Repace this block
$keywords = $this->get('keywords'); if ($keywords != '') { $userList->filterByKeywords($keywords); }
With
$keywords = $this->get('keywords'); $groupID = $this->get('group'); if ($keywords != '') { $userList->filterByKeywords($keywords); } if ($groupID != '') { $userList->filterByGroup($groupID); }
Let me know if you have any more questions, or if you can not get it to work I will test for myself.
Hey thanks a lot that's excellent help.
Nige
Nige
Hi there
I tried to do this as well but I get the following message if I select any option from the drop down.
Fatal error: Call to a member function getGroupID() on a non-object in /Users/Rosie/Sites/mysite.com/concrete5.6.1.2/concrete/core/models/user_list.php on line 46
D you have any ideas why this is coming up?
Thanks in advance
I tried to do this as well but I get the following message if I select any option from the drop down.
Fatal error: Call to a member function getGroupID() on a non-object in /Users/Rosie/Sites/mysite.com/concrete5.6.1.2/concrete/core/models/user_list.php on line 46
D you have any ideas why this is coming up?
Thanks in advance
Hello!
When I try to do this, I also get this message:
Fatal error: Call to a member function getGroupID() on a non-object in /home2/conceptu/public_html/iebpv/models/user_list.php on line 51
Any ideas?
When I try to do this, I also get this message:
Fatal error: Call to a member function getGroupID() on a non-object in /home2/conceptu/public_html/iebpv/models/user_list.php on line 51
Any ideas?
Hello!
Made a slight correction to the code for the members page and it's working fine:
Made a slight correction to the code for the members page and it's working fine:
<?php $db = Loader::db(); $query = "SELECT gID, gName FROM Groups"; $result = $db->Execute($query); ?> <select name="group"> <option value=""></option> <?php while($row=$result->fetchRow()) { $gID = $row['gID']; $gName = $row['gName']; ?><option value="<?php echo $gName?>"><?php echo $gName?></option><?php } ?> </select>
Slight error in the code it should be filter by the group name, not the group ID
$userList->filterByGroup('Group Name');
For the \concrete5\controllers\members.php file you should just add
right below the first "if" statement.
Not sure if this is what you were asking for...