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 \\{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