Last visit of a user

classic Classic list List threaded Threaded
15 messages Options
1j1
Reply | Threaded
Open this post in threaded view
|

Last visit of a user

1j1
How to get the "Last online: [date & time]" feature in Profile? Or better to say, is it on developers' to-do priority list?
I know there's online/offline indicator but I as anyone would like to know when was the user online last time, is he/she visits the forum sometime but doesn't post or doesn't post because hasn't been online for some time, etc.
Almost all forums - SMF, Forumotion, etc - have that kind of info & I'm greatly missing that on Nabble (along with many other features).
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

Pedro
You should use something like:
<n.this_user.set_property name="last_login" value="[n.now.long_format/]" />
to get the current time and put it where you want to register the user action.
In order to show it:
   <n.if.this_user.has_property name="last_login">        
        <then>
            <br/>
            <strong>Last Login: </strong><n.this_user.get_property name="last_login"/>
        </then>   
    </n.if.this_user.has_property>
My test forum.
1j1
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

1j1
Thank you once again, Pedro!  
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

NiTEMARE
In reply to this post by Pedro
Hi,

If I want this feature, should the codes be added to "registration_label" macro then?
On line 6?

- Timmie
The trick to creativity is knowing how to hide your sources - Albert Einstein.
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

Pedro
The first code, you can add at the html macro, because every user must pass through this one. The second can be added at profile_header macro in order to show the property at his profile.
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

NiTEMARE
Hi again,

I tried to add the code to html macro but I getting errors when ever I try to save.
It should be right before the <head>, but it seems to be stuck.

Maybe you can take a look at it or let me know on which line the codes should be?
Thanks once again.

- Timmie
The trick to creativity is knowing how to hide your sources - Albert Einstein.
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

Pedro
Actually, this is not so simple to implement. What I did was, show what you should do: set the property and show it.
Now, it is hard to set the property when the login happens, because this code is not in naml.

You should find another place where the user properties are used. What we can do for now, in my opinion, is set this time when the user visits his own account page.
After the following line at profile_header macro:
<n.if.local_user.is_authenticated>
   <then>
      <n.local_user.set_property name="last_login" value="[n.now.long_format/]" />       
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

NiTEMARE
Hi Pedro,

Thanks!
I think I will be able to fix that.

- Timmie
The trick to creativity is knowing how to hide your sources - Albert Einstein.
1j1
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

1j1
In reply to this post by Pedro
If I can put it this way - the added Last Visit feature doesn't work properly.  I mean I logged in, did some stuff, gone offline, came back after some days, did some activity, looked in my profile & it says that last activity was some days ago but not when it was in real time, so I click on my profile pic or refresh the Profile page & now it shows it correctly.
Is there a way for the feature to work correctly, because on another account there I was active during many days but it shows like if I did come there several days or weeks ago from that?
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

Pedro
Where have you added this code:
<n.this_user.set_property name="last_login" value="[n.now.long_format/]" />
My test forum.
1j1
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

1j1
I have that in profile_header.  But it's <n.local_user.set_property name="last_login" value="[n.now.long_format/]" />

Also in list_extra_fields :


      <n.if.this_user.has_property name="last_login">         
          <then> 
              <br/> 
              <strong>Last active: </strong><n.this_user.get_property name="last_login"/> 
          </then>    
      </n.if.this_user.has_property><br/>
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

Pedro
I f that is in profile _header, the date will only be saved when the user gets into his profile.
My test forum.
1j1
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

1j1
So where should it be put then so that it will save the visit data whenever the user comes online?  Maybe somehow on a home page?  But what if the user will come only to some particular page via the link & will go offline after that?
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

Pedro
That is why we don't have this feature working 100%. The code should be somewhere, so it can save the user last visit.
My test forum.
1j1
Reply | Threaded
Open this post in threaded view
|

Re: Last visit of a user

1j1
Gives me an idea to input that <n.local_user.set_property name="last_login" value="[n.now.long_format/]" /> not only in profile but in every app & topic.