ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Last Visit not updated regularly/is inaccurate

May 18, 2011 11:54am

Subscribe [3]
  • #1 / May 18, 2011 11:54am

    Daniel H

    197 posts

    I’m struggling to understand how the last visit field for a member is updated. It seems that it very rarely updates for all users, even though they have definitely been visiting.

    For example I’m logged in and browsing the site and control panel for more than 20 minutes, and the last visit still says 2011-05-16 03:02 PM.

    Any ideas?

  • #2 / May 19, 2011 4:36am

    John Henry Donovan

    12339 posts

    Hi Daniel,

    last_activity is written in the db at the start of a session. It is then updated every 5 minutes by default which may explain the inconsistency in your testing

    If the user has been inactive for longer than the session length EE will update their last_visit item so that it contains the last_activity date.  That way, EE can show the exact time they were last visiting the site.

    The default user session length is 2 hours and the default control panel session length is 1 hour

    Take a look in system/codeigniter/system/libraries/Session.php for more on this

    Does that help?

  • #3 / May 19, 2011 5:07am

    Daniel H

    197 posts

    Thanks John - I saw that reply on another thread, but doesn’t quite explain why after 20 minutes of using EE, the last visit date isn’t updated? I.e. I would have thought after 5 minutes, the time and date would have updated?

  • #4 / May 19, 2011 5:21am

    John Henry Donovan

    12339 posts

    Daniel,

    What version and build of EE are you using?
    Are you using cookies, sessions or both for the control panel user?

  • #5 / May 19, 2011 11:40am

    Daniel H

    197 posts

    Build - 20101018, version 1.7.0

    Settings - https://skitch.com/dajaniel/fyjn4/colorsnapper

    Do these needs to be set to session?

  • #6 / May 20, 2011 8:55am

    Sue Crocker

    26054 posts

    Daniel, are you visiting the front end or the back end and expecting to see a change?

  • #7 / May 23, 2011 6:33am

    Daniel H

    197 posts

    Both. I would have thought the time would update either with either a front end or back end visit.

  • #8 / May 23, 2011 9:13am

    Sue Crocker

    26054 posts

    Hi, Daniel. Using this code snippet, I get the following results:

    Current time: {current_time format="%D, %F %d, %Y - %g:%i:%s"}
    {exp:query sql="select member_id, last_visit, last_activity from exp_members"}
    {member_id} - {last_visit format="%D, %F %d, %Y - %g:%i:%s"} - {last_activity format="%D, %F %d, %Y - %g:%i:%s"}
    {/exp:query}

    Current time: Mon, May 23, 2011 - 7:10:54

    1 - Mon, May 23, 2011 - 5:45:15 - Mon, May 23, 2011 - 7:06:42

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases