Skip to Content Skip to Menu

CB API

13 years 1 month ago - 13 years 1 month ago #177379 by civilizationitalia
CB API was created by civilizationitalia
I need to get info of a registered user in a php page outside CB.
This page is a wrapper in a menu item.

I followed krileon's tutorials "Include API externally" and "Establishing $user object" but I got an error when I try to import plugn.foundation.php file.

My code is the following:
Code:
global $_CB_framework, $mainframe; define( '_JEXEC', 1 ); define('JPATH_BASE', '../' ); define( 'DS', DIRECTORY_SEPARATOR ); include_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); include_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); $mainframe =& JFactory::getApplication('site'); 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.database' ); $myId = $_CB_framework->myId(); $cbUser =& CBuser::getInstance( $myId ); if ( ! $cbUser ) { $cbUser =& CBuser::getInstance( null ); } $user =& $cbUser->getUserData(); ... ...

I located the error on the line 3336 of plugin.foundation.php when it tries to create a JEditor object
Code:
$editor =& JFactory::getEditor();

The error reported is:

Fatal error: Class 'JObservable' not found in D:\\{Vhosts}\\legamontebaldo.it\\libraries\\joomla\\html\\editor.php on line 28, referer: http://localhost:8084/index.php?option=com_wrapper&view=wrapper&Itemid=7


I googled a bit and found that it could be a problem of Joomla installation but my files seem ok: observable.php file is present and correct, inclusion of plugin.foundation.php works correctly within CB.

Where am I wrong?

PS: a few missin info: Windows XP SP3, Apache 2.2.20, PHP 5.3.8, MySQL 5.5.14, Joomla 1.5.23, CB 1.7
Last edit: 13 years 1 month ago by civilizationitalia.

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

13 years 1 month ago #177394 by civilizationitalia
Replied by civilizationitalia on topic Re: CB API
Solved importing observable.php file:
Code:
include_once ( JPATH_BASE .DS.'libraries'.DS.'joomla'.DS.'base'.DS.'observable.php' );

Is it normal???

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

Moderators: beatnantkrileon
Powered by Kunena Forum