I need an array of all usernames from a certain usergroup. How can I update my Joomla 3 component code for use in Joomla 4?
jimport( 'joomla.access.access' );
$customers = JAccess::getUsersByGroup(2);
jimport( 'joomla.user.user' );
foreach($customers as $customer){
$user = JFactory::getUser($customer);
$userID = $user->id;
$arr = array();
$arr[$userID] = $user->username;
}
$this->users = $arr;