Templating question: users.lastonlineISO?
-
Hey guys,
In users_list.tpl there's a "3 days ago" block that displays how long ago that user registered.
If I want to add a block there that says how long ago the user was online... how would I go about that?Original block
<!-- IF route_users:joindate -->
<div title="joindate" class="joindate">
<i class='fa fa-clock'></i>
<span class='timeago' title="{users.joindateISO}"></span>
</div>
<!-- ENDIF route_users:joindate --> -
Or another way for me to find out which users have not been online in a while without going to each individual person's profile would suffice also!
-
@Whiplash174 users api only has lastonline there is no lastonlineISO
-
@pichalite thanks for the help pichalite. Would you mind telling me how I go about that?
<!-- IF route_users:lastonline -->
<div title="lastonline" class="lastonline">
<i class='fa fa-clock'></i>
<span class='timeago' title="{users.lastonline}"></span>
</div>
<!-- ENDIF route_users:lastonline -->is not generating anything on the page
-
@Whiplash174 you won't get
route_users:lastonline
in the users api so the condition will always failwhich user route do you want to add the last online time?
Even if you remove the condition I believe you need the time in ISO format for it to display so, you need to modify the users api to get that.
Add this after this line https://github.com/NodeBB/NodeBB/blob/master/src/user.js#L118
user.lastonlineISO = utils.toISOString(user.lastonline);
-
Thank you @pichalite
user.js, could this be a master 1.0 only file?I'm running 0.9.3
I find reference of <!-- IF route_users:lastonline --> all over the project.My goal is to get it to display for each user in users_list.tpl so that my admin can prune inactive accounts, or another way of going about it is fine too.
-
@Whiplash174 where do you see this reference
<!-- IF route_users:lastonline -->
?I don't see it anywhere in the persona theme
-
I made it up.
I copied this:<!-- IF route_users:joindate -->
<div title="joindate" class="joindate">
<i class='fa fa-clock'></i>
<span class='timeago' title="{users.joindateISO}"></span>
</div>
<!-- ENDIF route_users:joindate -->And now I'm trying to modify it to show "lastonline" instead. I don't know what I'm doing though.
-
@Whiplash174 you don't need the IF condition. Just follow these steps from my previous post to get it working.
@Whiplash174 you won't get
route_users:lastonline
in the users api so the condition will always failwhich user route do you want to add the last online time?
Even if you remove the condition I believe you need the time in ISO format for it to display so, you need to modify the users api to get that.
Add this after this line https://github.com/NodeBB/NodeBB/blob/master/src/user.js#L118
user.lastonlineISO = utils.toISOString(user.lastonline);
-
It works great @pichalite