Add a last_login field to users table. In Users:login() do something like:

$this->User->id = $this->Auth->user('id');
$this->User->saveField('last_login', date('Y-m-d H:i:s'));

Then you can fetch the id, name, etc. of all users whose last_login is
within some period of time. There's no bullet-proof way to deal with a
person closing their browser but this will at least give an
approximate list.

On Sun, Oct 11, 2009 at 9:07 PM, DigitalDude
<[email protected]> wrote:
>
> Hey,
>
> I need to figure out a solution for a problem. Let's say I have an app
> which is controlled bei Auth and ACL, so the user can log in into a
> system and do stuff.
>
> Everyone knows from several social networks or chat clients that when
> a user is logged in, and one or more friends are online, too, the
> status of these users is shown.
>
> The question is, how could I do such a thing in Cake? Is there any
> chance to retriebe the status of a user, and "flag" it so another user
> (which is his/her friend or so) can see that he's actually "online"?
>
> I think I could use a flag in the user's table like "online" with 1 or
> 0 as flag, and set the "online"-status to 1 as a user logs in. But if
> a user does not log out, maybe because he just closes the browser,
> there is no way to set the status back to 0 so an indicator could show
> the user as "offline" (which means, that the field "online" would be
> set back to 0).
>
> I'm very interested in solutions for such problems, so if you have any
> suggestions, please let me know.
>
> Regards,
>
> DD
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to