Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 2810

General Questions/New to Joomla! 4.x • How to sort output..

$
0
0
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.

Statistics: Posted by Spiraliz — Sun Dec 10, 2023 8:45 am



Viewing all articles
Browse latest Browse all 2810

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>