By benjamin beaugh on Friday, 04 December 2015
Likes 0
Views 772
Votes 0
Hi Guys!
Id like to display members from a particular group. I have the following code to display all members of the site but i would like to limit it to a particular group. Thanks for any help you can provide!
<?
require_once( JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php' );


$model = FD::model('Users');
$users = $model->getUsers();

foreach ($users as $user) {

$gr = FD::user($user->id);
echo $gr->getPermalink($options);
echo $gr->getName($options);


}
?>


As always, THANKS!
Benjamin
Hello Benjamin,

You can use this code instead:

$groupId = '1'; // define which group you want to display.
$model = FD::model('Groups');
$members = $model->getMembers( $groupId, array( 'users' => true ));


Hope this helps.
·
Friday, 04 December 2015 11:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Nick


I should also mention that I intend on pulling other use data such as custom fields, avatars and such and formatting it. Well your code work with those other methods?

Thanks!!
·
Friday, 04 December 2015 11:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Benjamin,

Yes, it should work. It will return you the user object.
·
Friday, 04 December 2015 11:44
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you Nick! worked perfectly.

Have a great weekend!

Benjamin
·
Friday, 04 December 2015 12:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Benjamin,

You're welcome.
·
Friday, 04 December 2015 12:47
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post