vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Last login date (https://vborg.vbsupport.ru/showthread.php?t=264128)

richy96 05-24-2011 12:20 PM

Last login date
 
Does $vbulletin->userinfo['lastvisit'] contain the login date/time for the users previous session or is that the start date/time of the current login session?

I want to show users things that have happened on site since they last visited (new members, blog entries etc) so need to know when they last used the site

cheers
Rich

Disasterpiece 05-24-2011 12:41 PM

I don't know the answer, but it's quite easy to find out by yourself :P

richy96 05-24-2011 01:22 PM

yes did a test - it holds start of this session

was just being lazy :p

suppose I will have to get the previous value at log in and use that to find all new activity since last visit

unless it is already held in some other place?

Rich

Disasterpiece 05-24-2011 01:38 PM

you could check the user table if anything looks like a date from last login, otherwise I suppose you've to code it yourself. It's not particularly hard.

richy96 05-24-2011 03:52 PM

Actually the last logged in date seems to behave in a more complex way than I first thought

If you wander around the site a while then close your browser without logging out - I left it for about half an hour after that - then come back to the site and are still logged in (as you clicked 'remember me') then the lastactivity time is copied to the lastvisit time and lastactivity is set to the time you came back to the site. There appears to be some time out setting after which the site assumes you have been away and this is a new 'visit'.

This is OK for what I want as lastvisit is set to time of you were last active on the site so I can use it to find the events I am interested in that have occurred since then

However if you actually log out and then log back in again the lastvisit date/time is set to the time you just logged in, and the lastactivity is set a very short time (few seconds) after that. So I can't use lastvisit now to find out what has been happening in the members absence.

This makes what I am trying to do more complex - any ideas? Maybe I can grab lastactivity when a log in occurs just before it is updated, save that original value in some variable - then if that variable is set (user logged in) use it for lastvisit, if it is not set (user returned to the site) then use $vbulletin->userinfo['lastvisit']

Not sure if that would work out without trying it

Rich
PS I haven't even looked at what happens when a new member registers!

--------------- Added [DATE]1306261630[/DATE] at [TIME]1306261630[/TIME] ---------------

Oh don't worry about this - I've decided it isn't really feasible - and I would be better going with a system that shows what's been happening for the previous X days in descending date order. After a certain period the events drop off the list.

That's what a rival site is doing

Rich

BirdOPrey5 05-29-2011 10:09 AM

In the top right of the navbar where it says You last visited: it seems to always have the last time I actually visited a site. Such as right now it's 8:07 AM Sunday morning for me, it says my last visit here was 10:43 PM, EST Saturday, which is accurate.

Since I never log out I just leave the page open and do other stuff for hours at a time it seems to be able to know when I've stopped actively browsing the forum and it knows when I start actively browsing again it's a new visit.

Frosty 05-29-2011 10:13 AM

Yeah.. It's based on inactivity.


All times are GMT. The time now is 02:18 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01564 seconds
  • Memory Usage 1,721KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete