Load Community Builder values into BreezingForms form

7 years 2 months ago #290331 by bizguy
After a long learning curve I am posting this here so that should I need it again in the future or if others need it, it is here for reference.

Project: I needed to load logged in Community Builder users information into a BreezingForm. This included their name, email, complete address and phone. Here is what I did:
  1. First I setup the piece that inserts the Community Builder values into the form:
    • BreezingForms > Manage Pieces > New
    • Title: CB_values
    • Published: Yes
    • Package: CB Integration
    • Name: ff_load_CB_values
    • Type: Before Form
    • Description: This code inserts the CB user information into the BF form.
    • Code:
      $this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
       $db = JFactory::getDBO();//Get Database Object
       $user = &JFactory::getUser();//Get user Object
       
       //Create your own query 
       $db->setQuery('Select * From #__comprofiler Where id='.$user->id); 
       $results = $db->loadObject(); //load the results from the query
      
       // populate the values in the form
       ff_setValue('name', $results->firstname." ".$results->lastname); 
       ff_setValue('email', $user->email);
       ff_setValue('phone', $results->cb_phone);
       ff_setValue('address', $results->cb_address);
       ff_setValue('city', $results->cb_city);
       ff_setValue('postcode', $results->cb_zipcode);
       ff_setValue('country', $results->cb_country);
    • Save
  2. I created a form that had, in addition to form specific elements, the following elements with the following - Labels : Names (note the only important part is the names as these connect with the code above. Both may be substituted for your own needs however.)
    • Name : name
    • Email : email
    • Address : address
    • City : city
    • Province : province
    • Postal Code : postcode
    • Country : country
    • Phone : phone
  3. Next I updated the form to include the integration piece:
    • Advanced Tab > Form Options > More options
    • Form Pieces > Before Form > Library
    • select - CB Integration::ff_load_CB_values
    • Save
Now when you are logged in and go to your form, the information from your CB profile will be pre-loaded into the form.

I hope this saves others a bit of time.
The following user(s) said Thank You: kommid

Please Log in to join the conversation.

7 years 2 months ago #290344 by krileon
If BreezingForms supports Joomlas content prepare usage (content plugins) then you should be able to just substitute the values into your form after installing CB Content Bot.


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 to join the conversation.

7 years 2 months ago #290346 by bizguy
Thanks for the suggestion Kyle.

I found your reference to this in another post of yours, but I looked through the BreezingForms forum extensively, and have posted that question to their team as well. As far as I know at the moment, BreezingForms does not support Joomla Content plugins.

I will update this post should I find out differently in the future.
The following user(s) said Thank You: nant, krileon

Please Log in to join the conversation.

7 years 2 months ago #290357 by nant

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.201 seconds

Facebook Twitter LinkedIn