如何从站点前端或管理后端找出用户登录。
有没有办法找出用户登录?
试试这样,我想它可以帮助你。
<?php
$db = JFactory::getDbo();
$user = JFactory::getUser();
$query = $db->getQuery(true);
$query->select('s.time, s.client_id, u.id, u.name, u.username');
$query->from('#__session AS s');
$query->leftJoin('#__users AS u ON s.userid = u.id');
$query->where('s.guest = 0');
$db->setQuery($query);
$users = $db->loadObjectList();
foreach ($users as $user)
{
if($user->client_id) {
echo JText::_('JADMINISTRATOR');
} else {
echo JText::_('JSITE');
}
}
?>