Details
Description
When a user logs in, it doesn't always show them in the online users block. Sometimes they have to enter a course to finally show up on the site online users block. I tested my system by logging in 20 test users, and I was only getting 9 of them to show up. After making the following code change, the users seem to all be there.
$SQL = "SELECT u.id, u.username, u.firstname, u.lastname, u.picture, u.lastaccess, ul.timeaccess
FROM {$CFG->prefix}user_lastaccess ul,
{$CFG->prefix}user u
$groupmembers
WHERE
ul.userid = u.id
$courseselect
$timeselect
$groupselect
ORDER BY ul.timeaccess DESC";
to
$SQL = "SELECT u.id, u.username, u.firstname, u.lastname, u.picture, u.lastaccess, ul.timeaccess
FROM {$CFG->prefix}user_lastaccess ul,
{$CFG->prefix}user u
$groupmembers
WHERE
ul.userid = u.id
$courseselect
$timeselect
$groupselect
GROUP BY u.id
ORDER BY ul.timeaccess DESC";
Issue Links
| This issue is blocked by: | ||||
| MDL-10936 | Online Users block not updating |
|
|
|
| MDL-9662 | Current Online Users will not show new users when they log in without having enrolled in a course |
|
|
|
| This issue will be resolved by: | ||||
| MDL-9662 | Current Online Users will not show new users when they log in without having enrolled in a course |
|
|
|
Just a question because I'm not all that great at SQL but on the statement
WHERE ul.userid = u.id
Does that only then return users who have their id matching in the mdl_user_lastaccess table? If this is so, shouldn't the mdl_user_lastaccess table also be written to for the site course? If a user logs into moodle, they will not be recognized as online until they have entered a course for the first time. I might be completely off on this though.