如何显示Joomla中的注册用户列表? [英] How to show a list of registered users in Joomla?

查看:92
本文介绍了如何显示Joomla中的注册用户列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 数百个注册用户. 组 :

I have hundreds of registered users. Those are grouped in different user groups:

请参见下面的屏幕截图(为了保护我的客户网站,我做了一些改动):

See screenshot below (I changed this a little bit to protect my customers site):

  • 注册->老师
  • 注册->学生

如何在线显示教师"列表? 我想在表格或列表中列出所有这些老师,以便其他老师看到此信息.

How can I show a list of 'Teachers' online? I want to list up all those teachers in a table or list, so that other teachers see this information.

谢谢.欢迎提供任何信息.

Thank you. Any information is welcome.

推荐答案

您可以使用以下方法从特定用户组获取用户名:

You can use the following for to get the usernames from a specific user group:

$teachers = JAccess::getUsersByGroup(2); //change number in the brackets
$students = JAccess::getUsersByGroup(8); //change number in the brackets
foreach($teachers as $user_id) {
    $user = JFactory::getUser($user_id);
    echo $user->name;
}
foreach($students as $user_id) {
    $user = JFactory::getUser($user_id);
    echo $user->name;
}

将" 2 "和" 8 "更改为教师"和学生"用户组的ID.

Change "2" and "8" to the ID's of the Teachers and Students user groups.

希望这会有所帮助

这篇关于如何显示Joomla中的注册用户列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆