Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount! Get 20% off now with code SPOOKY-2024!

Include content from other components as profile tab

  • boyjahq
  • boyjahq
  • OFFLINE
  • Posts: 473
  • Thanks: 33
  • Karma: 3
7 years 11 months ago - 7 years 11 months ago #287571 by boyjahq
I am using CB Subs and Community Builder for subscription management and initial registration but using Fabrik to collect and display user profile information. I am looking for a way to display collected user profile information under a tab in the CB user profile page.

Example code for embedding the Fabrik I want to use is {fabrik view=details id=6 rowid=18}

If I paste this into a Joomla article, it displays as intended. Same if I paste it into a Custom Joomla Module. However, if I paste that same code into a CB Custom HTML field, it displays exactly as {fabrik view=details id=6 rowid=18}. Yes, I have parameter "Prepare content using CMS Content plugins" set to yes and all related plugins are installed and published.

So I again created a Custom Joomla module, called it Host Profile and assigned it to position hostprofile and entered the code {fabrik view=details id=6 rowid=18}. It displays correctly in all Joomla situations.

Then, in my CB Custom HTML field I entered:

{loadmodule mod_custom,HOST PROFILE}

And the resulting display was...

{loadmodule mod_custom,HOST PROFILE}

I tried {loadposition hostprofile} and the resulting display was {loadposition hostprofile}

As a test, I changed the content of my Joomla custom module to the following text: "What the hell?!?" and the resulting display was exactly that text. I then tried using the loadposition code for other modules that I have and they all displayed correctly in my CB tab.

So my question is, how can I display the contents of another component, one that seems to comply with Joomla rules, in a CB profile tab?
Last edit: 7 years 11 months ago by boyjahq.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
7 years 11 months ago #287581 by krileon
Sounds like an issue with how Fabrik is processing its shortcode. My guess is it isn't a proper Joomla content prepare plugin and is instead acting on the before or after content display triggers that only fire for Joomla content directly, but that doesn't explain why it works in a module. Since it works in a module it could be a content prepare plugin except it is specifically only working for certain contexts. Edit the Fabrik content plugin or system plugin as needed within Extensions > Plugins and see if it has a parameter to specify additional contexts for it to work in and if it does specify field.custom and field.layout contexts.

You could use a Code field and use PHP if Fabrik has PHP API to load in what you're wanting though.


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.

  • boyjahq
  • boyjahq
  • OFFLINE
  • Posts: 473
  • Thanks: 33
  • Karma: 3
7 years 11 months ago #287762 by boyjahq
I created a Code field and, as a test, inserted the following:

$userid = $user->get('id');
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery
->select(array('hostregion', 'hostshichousonjpn','hostactivities'))
->from('#__fab_host_profile')
->where('user_id = '.(int)$userid);
$myDb->setQuery($myQuery);
$row = $myDb->LoadObject();

The result on the front end is blank:



I debugged by adding the following code:

echo $myQuery;
var_dump($row);
exit;

And the result was:

SELECT hostregion,hostshichousonjpn,hostactivities FROM #__fab_host_profile WHERE user_id = 540object(stdClass)#1567 (3) { ["hostregion"]=> string(10) "_F_TOHOKU_" ["hostshichousonjpn"]=> string(9) "鹿角市" ["hostactivities"]=> string(27) "["_F_GENFARMINGKNOWLEDGE_"]" }

Can someone advise me what I need to do to have the data display properly?
Attachments:

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

  • boyjahq
  • boyjahq
  • OFFLINE
  • Posts: 473
  • Thanks: 33
  • Karma: 3
7 years 11 months ago - 7 years 11 months ago #287764 by boyjahq
OK, I played with it and added this as the last line of my code:

return 'Region: ' . $row-> hostregion . ' 市町村: ' . $row-> hostshichousonjpn . ' Activities: ' . $row-> hostactivities;

Which gives a result as:


So, I guess it's "working". But it is a HUGE form. I used just 3 sample fields for my test. Is there no way to have all fields for the row render in a nice layout without adding all tabel fields to the array, one at a time, and then somehow try to create a decent layout for the data?

OR, is there a way to simply include a link under the tab that opens the properly formatted Fabrik detail view in a modal or embedded window?
Attachments:
Last edit: 7 years 11 months ago by boyjahq.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
7 years 11 months ago #287775 by krileon
You've access to PHP. You can have it output however you want as long as you return a string. It even supports template files if you want to execute the code sent to it in a way other than an anonymous function. Doesn't look like you need PHP though and are just trying to output the results of a SQL query and recommend using a CB Query Field instead.


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