Skip to content

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

@squarou

Description

@squarou

Hi,
I opened this issue (modxcms/revolution#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions