Hello!
Iām looking or the aid of a Whoās online scripts. Is that possible with Kirby? Displays which users are online now?
Thanks for help
Hello!
Iām looking or the aid of a Whoās online scripts. Is that possible with Kirby? Displays which users are online now?
Thanks for help
I think the most simple solution would be to save the online status of each user in the User object, as an additional āis_onlineā field or something similar. Then you could just filter all users by this field using $users->filterBy('is_online', 'online')
. The only negative thing might be the need to update the user object each time someone logs in/out. This could be achieved with the userās update function.
Thanks!
Can I add $users->filterBy into the footer?
When I to this, than I became a error:
Fatal error: Call to a member function filterBy() on a non-object in ā¦
You have to define $users
first with $site->users()
: http://getkirby.com/docs/cheatsheet/site/users
Okay $user->filterBy(āis_onlineā, āonlineā) work.
But I canāt see any online Userā¦
Do you update your user information on login/logout to set the is_online
field as @jakobploens suggested?
Yes I have this doā¦
So what does $users->filterBy('is_online', 'online')
return if a user is currently logged in?
I all Userās there are onlineā¦?
So what is the problem? I donāt quite understand whatās missing.
is_online
via controlleris_online
is_online
via controllerI think I get the idea (Iāll have to try it).
But kirby logs out the user automatically from time to time (not sure about the interval).
You can change the interval from your Kirby configuration.