1

I am developing a mobile app which uses Joomla as the backend. So far I am able to get the user object through

$user = JFactory::getUser($id);

However, each time a user visits the app, I want it to set the lastvisitDate.

I have seen this erlated Doc JUser Class but I don't know how to use it. I will be glad if anyone can be of help - Thank you.

4
  • 1
    See joomla.stackexchange.com/questions/1046/… and joomla.stackexchange.com/questions/10602/…. They may be of some help.
    – jonboy
    Feb 22, 2016 at 8:30
  • 4
    Does the user login to the app using their Joomla credentials? If so, this information is already stored in the user object
    – Lodder
    Feb 22, 2016 at 9:30
  • Agreed with @Lodder, If your user logs into the site it will automatically update the database with the last visit information. From there you can query that info if you want to display it back to the user for some reason.
    – Terry Carter
    Feb 22, 2016 at 18:47
  • It is a mobile app running on Android which is using Joomla as the backend; and uses Ajax to interact with Joomla. Feb 29, 2016 at 22:06

1 Answer 1

2

Answering this based on my comment.

lastvisitDate is already stored in the JUser, object so you can access it like so:

$id   = 1;
$user = JFactory::getUser($id);
echo $user->lastvisitDate;

Your Answer

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

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