Updating 'last_activity'

Hardcore

Active member
Just some quick questions on the 'last_activity' row in the 'xf_user' table.

I'm using XF for user authentication and have non-XF pages with user submitted content. When users login to our non-XF pages they're redirected to them by the XF login system after successfully logging in. Some users may never even visit the forum as a result. As such, I'm noticing that their 'last_activity' is not being updated.
  • Does simply logging into XF not trigger an update?
  • When is 'last_activity' updated? What activities trigger an update?
  • Could I simply create custom code to update a user's 'last_activity' on my non-XF pages?
Thanks in advance ...
 
I'm updating the 'xf_user' table now, which works for a few things that I'm doing, but it looks like 'xf_session_activity' is tied into this on a XF visual level too. Would love to be able to for my non-XF pages to trigger activity on XF; last active on user views/profiles, members online now, etc.

Looks like it's time to do some code digging ...
 
The user last activities are updated by the hourly cron:

XenForo_CronEntry_CleanUp

The cron is called in the footer on XenForo pages.

When the last activities are updated it gets the activity info from the session records.

The session is setup on each page load in the controller:

XenForo_Controller::_setupSession

And the controller also updates session activity after each dispatch:

XenForo_Controller::postDispatch

In the case of external pages you probably aren't using a XenForo controller (aside from when you login). That means no activity updates after the login action unless you visit a XenForo page.

Hopefully this helps.
 
Back
Top Bottom