Userlist, only show users who are online.

4 years 6 months ago #314737 by XBOOMX
Replied by XBOOMX on topic Userlist, only show users who are online.
cb_gender is a dropdown. How should I add the values to the database query?



Can someone tell me how the database query then have to look complete?

Thank you very much
Attachments:

Please Log in to join the conversation.

4 years 6 months ago #314738 by Astrid
Replied by Astrid 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.`cb_gender` = 'm'
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

4 years 6 months ago #314740 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.`cb_gender` = 'm'

This way only the male users are shown. That would be correct, if I log in as a female user.
I need it separately. Female logged in only see male logged in. And around, of course, too.

Please Log in to join the conversation.

4 years 6 months ago #314748 by krileon
Replied by krileon on topic Userlist, only show users who are online.
You only want it to show males if a female is logged in and only females of a male is logged in? If that's correct the below would do that.

( SELECT COUNT(*) FROM `#__session` AS s WHERE s.`userid` = u.`id` AND s.`guest` = 0 ) > 0 AND ue.`cb_gender` = '[cb:if cb_gender="m"]f[cb:else]m[/cb:else][/cb:if]'


The IF substitution checks against the user viewing the userlist. If they're male it will filter the list to those who have female selected as the gender otherwise it will show users who have male selected as the gender.


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.
The following user(s) said Thank You: XBOOMX

Please Log in to join the conversation.

4 years 6 months ago #314752 by XBOOMX
Replied by XBOOMX on topic Userlist, only show users who are online.
Thanks krileon, that's the way it should be. Got it tested, works perfect.
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

4 years 6 months ago #314755 by XBOOMX
Replied by XBOOMX on topic Userlist, only show users who are online.
Can I extend this post by a similar one?
I also have a menu item "New Members". I would now create a new user list that displays new members, following the same principle as in the top posts. This time all new members should be displayed. The Community Builder Online module is good, but does not provide the configuration like a user list.
How does the database query look like to display new users, let's say for a month? After one month, they are not new and should therefore no longer be displayed as new.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.496 seconds

Facebook Twitter LinkedIn