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 🛍️ Black Friday Intro Offer for your subscription's lifetime
🎉 Black Friday sale is here! Great savings on professional and developer memberships! Get 25% off now with code BLACK-FRIDAY-2024!

CB and RSForms

  • AlexRag
  • AlexRag
  • OFFLINE
  • Posts: 501
  • Thanks: 33
  • Karma: 6
7 months 2 weeks ago - 7 months 2 weeks ago #337789 by AlexRag
CB and RSForms was created by AlexRag
UPDATE #2:  

I have a field item in CB that is a Dropdown type (Street Name).    From what I can see those are stored in "_comprofiler_field_values" but there also appear to be other entries in this table so it looks like I need to specify a specific "filedid"

To call up this list using $db->setQuery, I am not sure how to specify the fieldid.

Am I on the right track with this?  

$db->setQuery("SELECT `fieldtitle` FROM `#__comprofiler_field_values` WHERE ...
Last edit: 7 months 2 weeks ago by AlexRag.

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

  • AlexRag
  • AlexRag
  • OFFLINE
  • Posts: 501
  • Thanks: 33
  • Karma: 6
7 months 2 weeks ago - 7 months 2 weeks ago #337790 by AlexRag
Replied by AlexRag on topic CB and RSForms
FOLLOW-UP:   I did some more digging and found this article that helped answer some of my original questions:   www.rsjoomla.com/support/documentation/rsform-pro/custom-scripting/autopopulate-a-field-from-community-builder.html .

They provided the sample code below, so it does sound like I can pull data from CB.   So my revised questions:

1.  Will this code work in J4?  

2. What do I change to prepopulate other field items like address?

//<code>
$user = JFactory::getUser();
$db = JFactory::getDbo();
$userId = $user->get('id');

// Is the user logged in?
if ($userId) {
// Grab the value from the database.
$db->setQuery("SELECT `firstname` FROM `#__comprofiler` WHERE `user_id`='".$userId."'");
return $db->loadResult();
}
//</code>

My guess is to just change 'firstname' to the field name in the database

$db->setQuery("SELECT `customfieldname` FROM `#__comprofiler` WHERE `user_id`='".$userId."'");
return $db->loadResult();

3. If I wanted to display the full name (first + last) since I have each name as a separate field item, how can I return both together?   Would I program 2 queries and then loadResult both?    Sorry, I know this is all about SQL and not about CB.
 
Last edit: 7 months 2 weeks ago by AlexRag.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
7 months 2 weeks ago #337792 by krileon
Replied by krileon on topic CB and RSForms
Ideally RSForms would just support Joomla content plugins and you'd just substitute in those fields using CB Content Bot as it sounds like you just want to display them in RSForms? I would check with RSForms to see if they support Joomla content plugins as this would avoid having to code anything at all.


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.

  • AlexRag
  • AlexRag
  • OFFLINE
  • Posts: 501
  • Thanks: 33
  • Karma: 6
7 months 2 weeks ago #337797 by AlexRag
Replied by AlexRag on topic CB and RSForms
Thanks, Kyle.  I have reached out to them but will follow up to see if they can utilize the CB Content Bot.  

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

Moderators: beatnantkrileon
Powered by Kunena Forum