Groups

Permalink
I'm creating a new C5 App for the dashboard... as part of the process I need to get a list of available groups (which will be presented to the user) and then use whatever group is selected to ultimately retrieve a list of users in that group... This will all be done from within the dashboard... so what I need help with is...

1. code to retrieve an array of all groups.

2. retrieve an array of all users in a given group.

can anyone point me in the right direction..?

JimboJetset
 
okhayat replied on at Permalink Reply
okhayat
Your best bet is:
http://www.concrete5.org/api/
As a quicky:
1. To retrieve a list of groups:
<?php
Loader::model('search/group');
$ga = new GroupSearch();
$groups = $ga->getPage();
?>

2. List of members in a group:
<?php
// find the group
$gr = Group::getByID($gID); // OR
$gr = Group::getByName($gName);
// get array of members
$users = $gr->getGroupMembers();
?>

3. Get the count of users in group:
<?php
echo $gr->getGroupMembersNum();
?>


* Note: concrete/single_pages/dashboard/users/groups.php is also a nice live example.
JimboJetset replied on at Permalink Reply
JimboJetset
.. really appreciate the help...

Jim
Remo replied on at Permalink Reply
Remo
It's not finsihed but works fine so far:

http://www.concrete5.ch/index.php/download_file/-/view/7/...

C5 API as CHM file..