call to undefined function cbgetparam()

10 years 9 months ago #150950 by sfraise
I'm trying to use this in an external page outside of the comprofiler but I get a call to undefined function cbgetparam() error.
<?php global $_CB_framework, $_CB_database, $ueConfig, $mainframe, $_SERVER;
$user_id = cbGetParam( $_REQUEST, 'user', null );
$myId			=	$_CB_framework->myId();
$cbUser			=&	CBuser::getInstance( $myId );
 
if ( ! $cbUser ) {
	$cbUser		=&	CBuser::getInstance( null );
}
 
$user			=	$cbUser->getUserData();
if ( ! $user ) {
	return;
}
$query = "SELECT username FROM jos_users WHERE id = ". (int) 
$_CB_framework->myId();
$_CB_database->setQuery( $query );
$username = htmlspecialchars( cbUnHtmlspecialchars( $_CB_database->loadResult() ) );
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' );
 
$cb_groups	=	$cbUser->getTab( '31' );
?>
<a href="#" id="contentlink2" rel="subcontent2">My Groups</a>

<DIV id="subcontent2" style="position:absolute; visibility: hidden; border: 3px solid black; -moz-border-radius: 8px; border-radius: 8px; background-color: #edeff4; filter:alpha(opacity=97); -moz-opacity:0.97; -khtml-opacity: 0.97; opacity: 0.97; width: 400px; height: auto; overflow: scroll; padding: 4px; z-index:99;">
<?php echo $cb_groups ?>
<div align="right"><a href="javascript:dropdowncontent.hidediv('subcontent2')">Close</a></div>

</DIV>

<script type="text/javascript">
//Call dropdowncontent.init("anchorID", "positionString", glideduration, "revealBehavior") at the end of the page:

dropdowncontent.init("contentlink2", "right-top", 350, "click")

</script>

This works fine when using it on other pages so not sure what I'm missing here.
Any ideas?

Please Log in to join the conversation.

10 years 9 months ago #150964 by nant
Is there some reason you are posting to the CB 1.2.3 area?
If you are on this version you need to upgrade.

We will be closing this area very soon - so best to stop using it.

Please Log in to join the conversation.

10 years 9 months ago - 10 years 9 months ago #150997 by sfraise
Replied by sfraise on topic Re: call to undefined function cbgetparam()
I've got way too much customized to justify upgrading until cb 2.0 comes out since starting this project in September.

It's not an issue with the version, I'm sure I would get the same error in 1.3.
Let's just say in general, regardless of version, I'm using the above mentioned code to load the "my groups" tab in a left menu. I'm using cbprofilepro to handle the cb profiles, and am using raw content plugin to include php code in articles. This works when on the edit profile section, and of course I just use the loadtab command on the profile it's self, but it doesn't work outside of the comprofiler section. Can I not use the cb api outside of comprofiler pages, this doesn't seem right as external modules use the api right? If not then I guess there's no way to actually call a tab outside of the comprofiler and In this case I assume I need to just use a regular query to define the user and my groups variable?

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.148 seconds

Facebook Twitter LinkedIn