Hi all.
I'm using this query in joomla to get all members from specific group,
It works great, but I want to sort the output by username. Does anyone know how I can do that?
<?php
/*** Change Group ID to the group you want to be displayed: ***/
$groupId = 2;
/**********************/
$access = new JAccess();
$members = $access->getUsersByGroup($groupId);
$rows = '';
foreach ($members as $id){
$user = JFactory::getUser($id);
$rows .= '<tr>';
$rows .= '<td>' . $user->username . '</td>';
$rows .= '<td>' . $user->name . '</td>';
$rows .= '</tr>';}
?>
<table style="width:100%">
<?php echo $rows;?>
</table>
Tnx in advance.
I'm using this query in joomla to get all members from specific group,
It works great, but I want to sort the output by username. Does anyone know how I can do that?
<?php
/*** Change Group ID to the group you want to be displayed: ***/
$groupId = 2;
/**********************/
$access = new JAccess();
$members = $access->getUsersByGroup($groupId);
$rows = '';
foreach ($members as $id){
$user = JFactory::getUser($id);
$rows .= '<tr>';
$rows .= '<td>' . $user->username . '</td>';
$rows .= '<td>' . $user->name . '</td>';
$rows .= '</tr>';}
?>
<table style="width:100%">
<?php echo $rows;?>
</table>
Tnx in advance.
Statistics: Posted by Spiraliz — Sun Dec 10, 2023 8:45 am