I'm migrating users and I came across the $user object.

What's the difference between the login and access field? Does access get updated with every page request?

2 Answers 2


The access field is updated in Drupal's session write handler _drupal_session_write. This means it is potentially updated at every page request. If you look at the source code, you'll see that the access field is, by default, only updated every 180 seconds. This interval can be changed by setting the session_write_interval Drupal variable.

// Likewise, do not update access time more than once per 180 seconds.
if ($user->uid && REQUEST_TIME - $user->access > variable_get('session_write_interval', 180)) {
    'access' => REQUEST_TIME,
    ->condition('uid', $user->uid)

According to the the comments for the fields in user_schema():

access: Timestamp for previous time user accessed the site.

login: Timestamp for user’s last login.

So access would get updated for each page load, login only when the user actually logged in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.