Login icon indicating copy to clipboard operation
Login copied to clipboard

thislogin and lastlogin are the same value, but different with :ago modifier

Open squarou opened this issue 7 years ago • 1 comments

Hi, I opened this issue (https://github.com/modxcms/revolution/issues/14130) in the core repo, but thanks to @Jako now I know that I'm in the right place.

Summary

In users attributes, thislogin and lastlogin are the same values. I can't use a real lastlogin

Step to reproduce

Put this in a page after the user's loggedin (tested with a normal user - not administrator).

[[!Profile? &prefix=`user.`]]
[[!+user.lastlogin:date=`%d-%m-%Y %H-%M`]]
[[!+user.thislogin:date=`%d-%m-%Y %H-%M`]]

and

[[!+user.lastlogin]]
[[!+user.thislogin]]

Observed behavior

In both cases, the 2 dates (values) are the same. But : using ago modifier [[!+user.lastlogin:date=`%d-%m-%Y`:ago]] seem to output the right value, the one stored in DB before the user loggedin.

[[!+user.lastlogin]] ==> 1541682071 [[!+user.lastlogin:ago]] ==> il y a 14 heures, 11 min [[!+user.lastlogin:date=%d-%m-%Y %H-%M]] ==> 08-11-2018 1401

[[!+user.thislogin]] ==> 1541682071 [[!+user.thislogin:ago]] ==> il y a 14 heures, 11 min [[!+user.thislogin:date=%d-%m-%Y %H-%M]] ==> 08-11-2018 1401

Expected behavior

I guess that [[+lastlogin]] should display the last time the user loggedin and [[!+user.lastlogin]] [[!+user.thislogin]] should be quite different.

[[!+user.lastlogin]] ==> 1541624471 [[!+user.lastlogin:ago]] ==> il y a 14 heures, 11 min [[!+user.lastlogin:date=%d-%m-%Y %H-%M]] ==> 07-11-2018 2201

[[!+user.thislogin]] ==> 1541682071 [[!+user.thislogin:ago]] ==> il y a 0 heures, 1 min [[!+user.thislogin:date=%d-%m-%Y %H-%M]] ==> 08-11-2018 1401

Environment

MODX 2.6.5 Login 1.9.7-pl

squarou avatar Nov 08 '18 13:11 squarou

There some way to fix it at least temporarily?

yuliyepes avatar Feb 16 '20 21:02 yuliyepes