Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 25th)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Advanced filter in CB List

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
9 years 11 months ago #257418 by chanteur94
Advanced filter in CB List was created by chanteur94
Hi
I'm a little confuse with the Advanced filter of cb list.

On a one hand, we should use SQL format (SELECT FROM WHERE) and in tutorial 33 (YouTube) we should use ue.'cb_xxx'..

1 - For me, ue.'cb_xxw' doesn't work.

2 - where can i find the list and uses of table of CB (for exemple #_session, #cbsubs_subscriptions' .....

3 - I would like to filter a list of users online with the same 'gender' that the user connected' like :

( ( SELECT COUNT(*) FROM `#__session` AS s WHERE s.`userid` = u.`id` ) > 0 and cb_gender='female' ) works

( ( SELECT COUNT(*) FROM `#__session` AS s WHERE s.`userid` = u.`id` ) > 0 and cb_gender=$cb_gender ) doesn't works



Is there a documentation about all that.

Thanks a lot.
Best regard.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
9 years 11 months ago #257447 by krileon
Replied by krileon on topic Advanced filter in CB List

1 - For me, ue.'cb_xxw' doesn't work.

That's because you're using single quotes. You need to use ` not ' for columns and table escaping. Single quote is for value escaping. Please read up on MYSQL documentation and SQL tutorials found below carefully to become more familiar with SQL.

Documentation: dev.mysql.com/doc/refman/5.6/en/index.html
Tutorials: www.w3schools.com/sql/default.asp

2 - where can i find the list and uses of table of CB (for exemple #_session, #cbsubs_subscriptions' ....

Browse your database using phpmyadmin or whatever database software you host provides.

3 - I would like to filter a list of users online with the same 'gender' that the user connected' like :

You would need to have something like the below.

Online:
Code:
( ( SELECT COUNT(*) FROM `#__session` AS s WHERE s.`userid` = u.`id` ) > 0 ) AND ( `cb_gender` = '[cb_gender]' )

Offline:
Code:
( ( SELECT COUNT(*) FROM `#__session` AS s WHERE s.`userid` = u.`id` ) = 0 ) AND ( `cb_gender` = '[cb_gender]' )

The substitution will substitute in the viewing users gender. This will likely return no results if you're viewing as a public user since they won't have a gender field value so I recommend making the userlist accessible to registered users only.

Please see the below tutorial for further substitution usage information.

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb


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: chanteur94

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

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
9 years 10 months ago #258483 by mfe13
Replied by mfe13 on topic Advanced filter in CB List
Hello,

But in the list, how to show users online in first and then offline ones Following?
Or sort by last date first visit?
It must also write a manual request?

Thanks

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

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
9 years 10 months ago #258488 by chanteur94
Replied by chanteur94 on topic Advanced filter in CB List
Sorting by last connections works fine for me ...(users online th en offline)

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

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
9 years 10 months ago #258491 by mfe13
Replied by mfe13 on topic Advanced filter in CB List
Hi,

Yes, but how have the users online at the beginning of the list, for me it's mixed!
Attachments:

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
9 years 10 months ago #258534 by krileon
Replied by krileon on topic Advanced filter in CB List
This topic is regards to an Advanced Filter. Sorting is a completely different query and usage. I'm guessing you're sorting by Last Online field, which is just a datetime; it's not an indication of them actively being logged in. To sort by online status you need to use an Advanced Sort By which adds directly to the ORDER BY of the query. The below Advanced Sort By will probably work.

Online First
Code:
( SELECT s.`time` FROM `#__session` AS s WHERE s.`userid` = u.`id` LIMIT 1 ) DESC


Offline First
Code:
( SELECT s.`time` FROM `#__session` AS s WHERE s.`userid` = u.`id` LIMIT 1 ) ASC


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.

Moderators: beatnantkrileon
Powered by Kunena Forum