Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Userlist, only show users who are online.

  • XBOOMX
  • XBOOMX
  • OFFLINE
  • Posts: 131
  • Thanks: 12
  • Karma: 0
5 years 2 months ago #314673 by XBOOMX
Hi,
what do I have to set to display in a user list only users who are online?

Thx, Thomas

Please Log in or Create an account to join the conversation.

  • XBOOMX
  • XBOOMX
  • OFFLINE
  • Posts: 131
  • Thanks: 12
  • Karma: 0
5 years 2 months ago #314674 by XBOOMX
Replied by XBOOMX on topic Userlist, only show users who are online.
ok, this is fine:
( SELECT COUNT(*) FROM `#__session` AS s WHERE s.`userid` = u.`id` AND s.`guest` = 0 ) > 0

but it indicates men and women. I need it separately.
If a man is logged in, it should only show women who are online. If a woman is logged in, she only sees men who are online now.

Please Log in or Create an account to join the conversation.

  • XBOOMX
  • XBOOMX
  • OFFLINE
  • Posts: 131
  • Thanks: 12
  • Karma: 0
5 years 2 months ago #314699 by XBOOMX
Replied by XBOOMX on topic Userlist, only show users who are online.
I need help. How can I sort it out that only women or only men are displayed online?
Thomas

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
5 years 2 months ago #314716 by krileon
Replied by krileon on topic Userlist, only show users who are online.
The Advanced filtering directly adds to the WHERE clause of the userlist query. Your first usage will work fine to filter to online users. If you also want to filter by a field you need to add an AND clause to your usage and add the field filtering there. Example as follows.

Code:
( SELECT COUNT(*) FROM `#__session` AS s WHERE s.`userid` = u.`id` AND s.`guest` = 0 ) > 0 AND ue.`FIELD_NAME` = 'FIELD_VALUE'


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • XBOOMX
  • XBOOMX
  • OFFLINE
  • Posts: 131
  • Thanks: 12
  • Karma: 0
5 years 2 months ago #314725 by XBOOMX
Replied by XBOOMX on topic Userlist, only show users who are online.
( SELECT COUNT(*) FROM `#__session` AS s WHERE s.`userid` = u.`id` AND s.`guest` = 0 ) > 0 AND ue.`FIELD_NAME` = 'FIELD_VALUE'

Thanks for the hint, but it does not work out. I use a cb_gender field that the users have to fill in as mandatory. Unfortunately I am not so good with database queries. I have now inserted cb_gender in her example. What should be included in FIELD_VALUE?

( SELECT COUNT(*) FROM `#__session` AS s WHERE s.`userid` = u.`id` AND s.`guest` = 0 ) > 0 AND ue.`cb_gender` = 'FIELD_VALUE'

Thanks for possible solutions

Please Log in or Create an account to join the conversation.

  • Astrid
  • Astrid
  • OFFLINE
  • Posts: 183
  • Thanks: 68
  • Karma: 10
5 years 2 months ago #314730 by Astrid
Replied by Astrid on topic Userlist, only show users who are online.
Code:
that the users have to fill in as mandatory
You should use a checkbox or dropdown field and then use the value that you've inserted in the value field.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum