I’m trying to show how long time ago the user was logged in, for some reason doesn’t work.
The date is right when I print but not when I add ‘ago’ to the tag
This shows the date and it’s right:
[[+lastlogin:date=%d-%m-%Y %H-%M]] -> 13-02-2020 08-40
this is what it shows when I put ‘ago’ to the tag
[[+lastlogin:date=%d-%m-%Y %H-%M:ago]] -> 50 years, 1 month ago
[[+lastlogin:ago]] -> 50 years, 1 month ago
I tried in a different way but also doesn’t work, this looks like is showing the actual time
[[+lastlogin:date=%d-%m-%Y:ago]] -> 9 hours, 31 minutes ago
This is what actual time print shows.
[[!+nowdate:default=now:strtotime:date=%d-%m-%Y %H-%M]] -> 13-02-2020 09-31
Okay, apparently the correct way to call the tag is [[+lastlogin:date:ago]] that gave me the right format but not the right information.
What I see for the ‘web users’ is in the database the column ‘thislogin’ and ‘lastlogin’ have the same value and this value is always the current session date not the last session date.
For ‘manager users’ (admin) this works perfectly but what I want is implement this only for the web users. This is my login call.
It sounds like the when the web users log in, the lastlogin value gets updated to the current time during the login process. Is the lastlogin value correct before the user logs in?
You might be able to capture the lastlogin value before it gets changed with a snippet that runs on the log in page before the user logs in, or (maybe easier) with a plugin attached to one of the early login events.