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

Get online time of user

Discussion in 'XenForo Development Discussions' started by Alex__, Oct 24, 2013.

  1. Alex__

    Alex__ Active Member

    i would like to get the online time of users, to measure how long they are online, but i dont know how to approach this in a performant way.

    i have seen such counters in smf, ipb etc already.

    anyone has an idea?
    would be much appreciated :)
     
  2. Nobita.Kun

    Nobita.Kun Well-Known Member

    If you enable deverlopment so you simply edit option.
    `User Options` --> Online Status Timeout (minutes)
     
  3. Alex__

    Alex__ Active Member

    yes, have seen that. :D

    thought into hooking that, but it is quiet difficult for me to get the exact seconds the user spends online.

    still, thank you very much for reminding me about that again, doing to examine the code behind it again, maybe there is something i missed, when i looked at it the first time :)
     
  4. EQnoble

    EQnoble Well-Known Member

    I don't think you could be 100% accurate and get exact seconds unless you make some kind of ajax call on every page every second which would incrementally increase a value in the db for something like time_online, on the other hand if you were to round the ajax polling to like 45 seconds or a minute you could probably do something with it that wouldn't kill your db with constant writes for every online user every second.
     
  5. Alex__

    Alex__ Active Member

    yes, thats exactly what i worried about.

    i really think the best approach is to measure the online timeout or some kind of that.

    thanks!
     

Share This Page