The crux of it is that 'lastlogin' actually records the last-but-one time that a user has logged in.There are two related fields in the mdl_user table that get updated when a user logs in: 'currentlogin' and 'lastlogin'.Each time a user logs in: - 'currentlogin' gets updated with the present time - 'lastlogin' gets updated with the previous value of currentlogin.

For example, quite a number accounts have zero in lastlogin yet data in the user_lastaccess table.

First of all I thought this could be explained by people “logging is as”, but the issue is too widespread for this. Foolishly I made some use of last login in some custom code I did, and it has come back to bite me.

I do understand, by the way, that last access and last login are not the same things.

Much appreciated Dave This response may be a bit late, but I was just looking into the same thing and it may be helpful for other people.

The first time a user logs in, currentlogin will get populated with a date but lastlogin will remain 0.

So, users with a 0 for lastlogin but a non-zero lastaccess and user_lastaccess records are actually users who have logged in exactly once.Q: How can I find out a user's last logon time in a Windows domain?I found something that I cannot resolve by my self. :( I need to get result to select each user with his id, and show their last login info, for example from this table: id name login Time logout Time 3 test 2013-11-25 null 4 test1 2013-11-20 null 6 test2 2013-11-19 null 3 test3 2013-11-27 null 16 test4 2013-11-09 null 3 test 2013-12-02 null 2 test5 2013-11-11 null 4 test1 2013-11-17 null 6 test2 2013-11-30 null ...Hi folks I wonder if anybody else has come across this.I have a 1.8.7 moodle install using ldap for authentication.I've noticed that there is a disparity between the lastlogin time recorded in the user table and the stats held in user_lastaccess.