Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Intro Black Friday Offer for a lifetime*

Using CB Substitution within Query field

  • wbuk
  • wbuk
  • OFFLINE
  • Posts: 116
  • Thanks: 8
  • Karma: 1
4 years 10 months ago - 4 years 10 months ago #316227 by wbuk
We are wondering if you could tell us why this isn't working. We have a Query Drop Down (Single Select) field called cb_class. Within its Query Parameter, we have:
Code:
SELECT DISTINCT `cb_class` FROM `wbedu_comprofiler` WHERE `cb_school` = '[cb:userdata field="cb_school" user="#displayed" /]'

Nothing shows in the dropdown. But if query changed to:
Code:
SELECT DISTINCT `cb_class` FROM `wbedu_comprofiler` WHERE `cb_school` = 'Demo School'

or
Code:
SELECT DISTINCT `cb_class` FROM `wbedu_comprofiler` WHERE `cb_school` = '[cb:userdata field="cb_school" user="#me" /]'


It works fine. If [cb:userdata field="cb_school" user="#displayed" /] is put anywhere else, it displays Demo School. So we are not sure why the first query isn't working?

Web Buster UK Ltd
Last edit: 4 years 10 months ago by wbuk.

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

  • wbuk
  • wbuk
  • OFFLINE
  • Posts: 116
  • Thanks: 8
  • Karma: 1
4 years 10 months ago #316228 by wbuk
Replied by wbuk on topic Using CB Substitution within Query field
Scratch that. We could have used the substitution [cb:userfield field="cb_school" /] which worked perfectly.

Web Buster UK Ltd

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
4 years 10 months ago #316238 by krileon
Replied by krileon on topic Using CB Substitution within Query field
#displayed is a special user parameter value for substitutions. It only applies to profile view. It's not set anywhere else. So using it outside of profiles for example will not work. In most cases however it shouldn't be necessary as for example all fields substitutions always use the profile owner as the substitution source so just using substitutions without the user parameter will give you the expected result.


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