1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Last Visited

Discussion in 'XenForo Questions and Support' started by Amaury, Jul 22, 2016.

  1. Amaury

    Amaury Well-Known Member

    Not really sure if this counts as a styling question; if it does, please move it there.

    How easy would it be to implement essentially the same feature vBulletin had? Is the data already there and it just needs to be exposed similar to users viewing this thread or forum via template edits?

    Last Visited.png

    In vBulletin, the last visited was based on whatever you had the online status timeout option set to—for argument's sake, let's just say the default 15 minutes. So if your last activity was at 2:56 PM and you came back at 3:28 PM, your last visited would show as 2:56 PM. Then if you came back at 3:47 PM, your last visited would show as 3:28 PM. And so on.

    In XenForo, I suspect it would work a bit differently because of the relative times and such. For argument's sake, we'll again say the online status timeout is set to the default 15 minutes. Even after 15 minutes passes and you are removed from the Members Online Now block or the Current Visitors page, your activity still shows as relative until it's been 60 minutes, at which point your last visited would be set. If your last activity was at 3:44 PM and you came back at 4:45 PM, your last visited would show as 3:44 PM. However, if you then came back later at 5:32 PM, your last visited would still show as 3:44 PM because an hour hadn't passed.

    If I'm not making any sense, please me know, but hopefully I made some sense in my explanation. I also probably said way more than I needed to, but I suppose too much information is better than not enough, right? :cool:

    Anyway, the short version is: Is this possible in XenForo?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    last_activity is the closest thing that I am aware of:

    {xen:datetime $visitor.last_activity, 'M j, Y @ g:i A'}
    (use in templates)

    But this is activity that is updated hourly as you say.

    vB's last visit time is different.
    Amaury likes this.
  3. Amaury

    Amaury Well-Known Member

    Thanks, Jake! I'll give it a try.
  4. Amaury

    Amaury Well-Known Member

    @Jake Bunce, that actually works exactly how I wanted it to! Thanks! :D

    Last Visit 1.PNG Last Visit 2.PNG

    Although I did simplify it a bit so the time is relative:

    {xen:datetime $visitor.last_activity}
    Now, question: Is this only viewable by registered members? I don't really see guests needing it.
    maszd likes this.
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  6. Amaury

    Amaury Well-Known Member

    Perfect, @Jake Bunce! Good thing I did, anyway, as it was showing as 12/31/1969 for guests! :eek:

    One final question: How can I add a browser tooltip when hovering that provides the absolute value like other areas of similar nature, such as the member card?

    Browser Tooltip.PNG
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member


    <xen:datetime time="$visitor.last_activity" />
    Amaury likes this.
  8. Amaury

    Amaury Well-Known Member

    Jake! You are the man!

Share This Page