| 
Welcome, Guest

Custom joomla plugin needs to query CB. How?
(1 viewing) (1) Guest

TOPIC: Custom joomla plugin needs to query CB. How?

Re:Custom joomla plugin needs to query CB. How? 3 years, 1 month ago #93394

Bump topic...

I'm still having this problem. Ever since I upgraded my dev environment to 1.2 release, I get this error:

Fatal error: Class 'comprofilerDBTable' not found in /joomla_development/tap/administrator/components/com_comprofiler/library/cb/cb.tables.php on line 16

This is the code that is causing this:

 
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_comprofiler'.DS.'plugin.foundation.php' );
global $_CB_framework, $ueConfig, $mainframe;
 
$cb_user = CBuser::getInstance($joom_user);
 
 


The stack trace is the same as below. What am I missing?

Thanks!

-Ed
The topic has been locked.

Re:Custom joomla plugin needs to query CB. How? 3 years, 1 month ago #93477

There appear to be some fundamental dependency issues in CB. At least for what I am trying to do.

I finally got getting an instance of the cbUser, by adding the following line of code to cb.tables.php:
 
require_once('cb.database.php');
 


What am I missing?

Now there is a dependency failure when calling getField():

Class 'cbTabs' not found in .../administrator/components/com_comprofiler/plugin.foundation.php on line 881

What am I missing, or am I the first person to try this??
The topic has been locked.

Re:Custom joomla plugin needs to query CB. How? 3 years, 1 month ago #93540

Something is totally wrong.

I'm trying to figure out what dependencies I am missing. It seems as if I am adding hacks on top of hacks.

After my post below, I had to add:
include_once( 'comprofiler.class.php' );

to the top of plugin.foundation.php. That got me past some issues. Now I've gotten to here:

cbimport( ) in comprofiler.class

Error:
Call to a member function getCfg() on a non-object

in this line of code:
require_once( $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_comprofiler/library/' . $filepath );


So, the _CB_framework object is not instantiated???!!!?!?!

I really wish I knew what is wrong.
The topic has been locked.

Re:Custom joomla plugin needs to query CB. How? 3 years, 1 month ago #93547

  • Rapunzl
  • Rapunzl
  • OFFLINE
  • Platinum Boarder
    Platinum Boarder
  • Posts: 3297
  • Karma: 108
I don't think anyone will suggest trying to hack CB. Creating a plugin doesn't hack the code and therefore, doesn't cause unexpected errors in other aspects of the component or plugins.

Your best bet is studying other CB 1.2 plugins, waiting for the API to be released or request knowledgeable assistance to accomplish your task (likely for a fee).
Jamie (Rapunzl)
Community Builder Team Member

Before posting on forums: Read all CB Articles | Specially the FAQ | Help us help you
CB links: Subscribe to CB documentation | Our templates | Paid Subscriptions | Get Hosting | Our Forge
Visit my CB Profile

My personal site Rapunzl's Reality always under reconstruction
The topic has been locked.

Re:Custom joomla plugin needs to query CB. How? 3 years, 1 month ago #93560

  • ndee
  • ndee
  • OFFLINE
  • Platinum Boarder
    Platinum Boarder
  • Posts: 543
  • Karma: 19
Hi, you would have been a lot faster if you looked in some new plugins code.

What do you want to do with your plugin? Do you want to display the information in a tab? If yes take a look into existing plugins. You have to extend cbTabHandler first:
class getYOURPLUGTab extends cbTabHandler {
/**
* Constructor
*/

function getYOURPLUGTab( ) {
$this->cbTabHandler();
}
<... snip...>
 


your code goes then here
 
function getDisplayTab( $tab, $user, $ui ) {
global $_CB_framework, $_CB_database, $ueConfig;
// $_CB_database only needed if you do custom queries
// $ueConfig only needed if you want to read cb config params
 
<... snip ...>
 


If you want to access a cb table value you only need the $user object of the tab beeing displayed. e.g.
echo $user->cb_mycustomcbfield;

Take care above code only mentions snippets. Take a look into latest cb profilegallery plugin or similar.

Edit: To understand how plugins work you can take a look at old helloWorld plugins. They use the old api but instead of $mainframe etc. you only need the $_CB_framework global.
www.joomlapolis.com/content/category/5/26/37/

Post edited by: ndee, at: 2009/04/02 10:12
###################
SPEED UP HELP, read first: Help us help you
###################
The topic has been locked.

Re:Custom joomla plugin needs to query CB. How? 3 years, 1 month ago #93581

  • krileon
  • krileon
  • OFFLINE
  • Moderator
    Moderator
  • Posts: 24022
  • Karma: 695
 
global $_CB_framework, $ueConfig, $mainframe;
 
if ( defined( 'JPATH_ADMINISTRATOR' ) ) {
if ( ! file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) {
echo 'CB not installed!';
return;
}
include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );
} else {
if ( ! file_exists( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' ) ) {
echo 'CB not installed!';
return;
}
include_once( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' );
}
 
cbimport( 'cb.plugins' );
cbimport( 'language.front' );
 


Try the above. This is needed for 3rd party usage of CBs API. In a sense you can design anything with CBs API. Allowing 100% cross-compatible code.
Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
If you are a Advanced, Professional, Developer, or CBSubs 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 Advanced, 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 EST to 4:00 PM EST. 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.
--
My personal site(s)/link(s): AllMySocials - Tutorials
The topic has been locked.
Time to create page: 1.40 seconds