I am running Joomla 1.5.9 with Community Builder 1.2.2. I am trying to pre-populate a few fields with data that are already in CB (like name, email, phone number, etc) within a form component called BreezingForms. After reading the Community builder tutorials and the BreezingForms forums, I came up with the code listed below:
[code:1]$this->execPieceByName('ff_InitLib');
global $_CB_framework, $mainframe;
include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );
include_once( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' );
cbimport( 'cb.database' );
cbimport( 'cb.html' );
cbimport( 'cb.plugins' );
$myId = $_CB_framework->myId();
$cbUser =& CBuser::getInstance( $myId );
$user = $cbUser->getUserData();
ff_setValue('firstname', $user->firstname);
ff_setValue('lastname', $user->lastname);
ff_setValue('phone', $user->phone);
ff_setValue('email', $user->email);[/code:1]
After applying this code to the form, it doesn't work. I traced this issue and narrowed it down to not being unable to process the following variable within BreezingForms:
[code:1] $myId = $_CB_framework->myId();[/code:1]
When executed normally, the above code returns my CB ID (which is then used to get other CB profile information)--which we all know. However, when executed within BreezingForms, it constantly returns a zero for it's value. If I were to set the $myId string manually to my own ID, everything works and all fields get populated.
So my question is: How do I instantiate the CB framework within other components ($_CB_framework mainly)? Is there something I am missing? I spoke the BreezingForms support and that is the question they asked me to ask Joomlapolis.
Any help will be appreciated...
References:
-
www.allmysocials.com/articles/1-tutorials
-
crosstec.de/breezingforms-15-en-mainmenu-10.html
Thanks,
Rudy