Hi,
Module "Who is online" can display usernames but not real names. I have found several hacks to change that, but none corresponds to my config. Not sure if this is because I use Joomla! 1.7 or Kunena (may be it modifies this module?).
I have been able to display real names thansk to the following hack. I am not an expert, so if you identify a bug in the code please tell me! Anyhow it works for me and does not seem to generate issues with other modules or extensions.
1) In (site)\modules\mod_whosonline\helper.php, change :
static function getOnlineUserNames() {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('a.username, a.time, a.userid, a.usertype, a.client_id');
$query->from('#__session AS a');
$query->where('a.userid != 0');
$query->where('a.client_id = 0');
$query->group('a.userid');
$db->setQuery($query);
return (array) $db->loadObjectList();
}
Replace by :
static function getOnlineUserNames() {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('u.name, u.id, a.username, a.userid');
$query->from('#__users AS u');
$query->innerjoin('#__session AS a ON u.id = a.userid');
$query->where('a.userid != 0');
$query->where('a.client_id = 0');
$db->setQuery($query);
return (array) $db->loadObjectList();
}
2) In (site)\modules\mod_whosonline\tmpl\default.php :
Replace “username” by “name” in following line (twice, lines 27 and 30) :
<?php echo $name->username; ?>
becomes
<?php echo $name->name; ?>
I have already received a lot from Joomla forums, I am glad I can give a bit now !
