[SOLVED] user_id for SQL query on the data of profile I am currently visiting

2 years 10 months ago - 2 years 10 months ago #325220 by iridia
I need to create a report that will show visitors only the data of the user whose profile they are currently visiting (not their own profile's data). How can I indicate the current profile's user_id (and not the user's) in an SQL query?

Thanks!

Please Log in to join the conversation.

2 years 10 months ago #325226 by krileon
In an SQL where? In a CB Query Field? If a query field just use [user_id] as substitutions are already set to the displayed user.


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

Please Log in to join the conversation.

2 years 10 months ago #325234 by iridia
It's not a CB Query field. I am creating a report that includes CB fields and Form Maker fields using Tabulizer, which uses standard MySQL. I want to include this as a module called within the profile. But when I use {user_id} it displays the visitor's data, not the profile's.

Please Log in to join the conversation.

2 years 10 months ago #325249 by krileon
Our substitutions are not {user_id}, they are [user_id]. We do not use curly brackets. I've also no idea where you are trying to use this substitution. Substitutions in CB Content Module for example are always going to be from the viewing user and you have to use [cb:userdata field="user_id" userr="#displayed" /] if you want displayed user, but this only works on profiles and recommend using [cb:userdata field="user_id" userr="#displayedOrMe" /] so it switches depending on if a displayed user is available.


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

Please Log in to join the conversation.

2 years 10 months ago #325301 by iridia
Thank you. After your responses, I decided to change my approach and implemented the report as a CB Query field using the Form Maker database. That worked great.

Thanks!
Alma
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.261 seconds

Facebook Twitter LinkedIn