Forum for discussing general topics related to Couch.
9 posts Page 1 of 1
Is it any chance to find all users with extended users? k_user_name showing the current logged in. Can I make so I can show all the logged in users?
You can try to list all users, because they are just cloned pages in a template.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
trendoman wrote: You can try to list all users, because they are just cloned pages in a template.


Do you mean k_is_list?

Should I use it in profile.php file?
users/index.php
This is the main template that 'extends' the native user accounts.

It serves two purposes -
a. All editable regions defined within this template will become part of the user accounts. This can be used to add any number of custom fields to users e.g. sex, qualification, address etc.

b. Each cloned page created from this template will automatically create and get associated with a user account. This can be used to create user accounts from the front-end using DataBound Forms.

I'm not sure that k_logged_in is set in extended environment as part of k_ variables in clonable pages. To see that I suggest an experiment:
1. Login simultaneously with at least 2 users.
2. Then, please, run <cms:pages masterpage='users/index.php' ><cms:dump_all /></cms:pages> and see if we can see k_logged_in among the set variables. It should be so that we have at least two of them (as the number of logged users is at least two).

Xtriz3D wrote:
trendoman wrote: You can try to list all users, because they are just cloned pages in a template.


Do you mean k_is_list?

Should I use it in profile.php file?
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Showing all current logged-in users (as, for example, in the footer of this forum), will require recording somewhere each user's info when she logs in. Additionally, this info needs to be periodically refreshed because a user can simply abandon her session without logging off. For example, this forum shows the list "based on users active over the past 5 minutes".

In short, showing such a list is not available out-of-the-box and coding it will require a bit of an effort.
KK wrote: Showing all current logged-in users (as, for example, in the footer of this forum), will require recording somewhere each user's info when she logs in. Additionally, this info needs to be periodically refreshed because a user can simply abandon her session without logging off. For example, this forum shows the list "based on users active over the past 5 minutes".

In short, showing such a list is not available out-of-the-box and coding it will require a bit of an effort.


KK, how much time passes before session is expired?
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Ok thanks for the answer.
Hi, thanks for reply and updates!
Now I see that the only other choice is to store information somewhere.

Sessions can't help, they are limited for current user, cookies are on client side only, so what we have left is a template, perhaps non-clonable globals.php and a special editable to store data with db_persist tag. So when any user logs in, db_persist adds new id with a time stamp and removes old ones.

This editable might be a simple text with ids of logged users and a time stamp. I see that the script which will perform 'checks' should be present on every template, and info will be updated on every page reload if 5 mins passed after last check. The time of last check also should be stored in another editable, I guess.

The problem that needs to be addressed is when a logged user is not browsing of pages, for example just sits and reads an article. This way he is still online, but script doesn't update info and therefore doesn't know status (or thinks he is already offline). I know, this has been solved somehow. This very forum is based on PHP, so probably the solution is known for a long time already. Maybe someone will shed light and educate us on the matter :)

It would be cool to list users as clonable pages in extended-users addon and have fresh reliable information on k_logged_in for all users. :)
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
KK, how much time passes before session is expired?

With 'Remember me' option, the cookie is set with a life of 14 days. Otherwise the default is 1 day (i.e. 24 hours).
9 posts Page 1 of 1