Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

CBuser::getInstance in 3rd party extension

  • Proteon
  • Proteon
  • OFFLINE
  • Posts: 44
  • Thanks: 1
  • Karma: 0
1 year 4 months ago #334650 by Proteon
The following code worked all good in Joomla 3 but it is giving "CBuser not found" error in Joomla 4. I am using this code in my own extension. Please let me know what's the fix for this to work in Joomla 4.

include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );
cbimport( 'cb.html' );
cbimport( 'language.front' );
outputCbTemplate();

global $_CB_framework, $_PLUGINS, $ueConfig;
$cbUser = CBuser::getInstance( $result, false );

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
1 year 4 months ago #334660 by krileon
Replied by krileon on topic CBuser::getInstance in 3rd party extension
That should still work fine and is how CB API is loaded into our Joomla modules. See the below tutorial which is still valid for including CB API externally.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18357-including-cb-api-for-usage-outside-of-cb

If you're calling that in a PHP file with a namespace you need to either add a user statement for CBuser or prefix it with \ 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.

Moderators: beatnantkrileon
Powered by Kunena Forum