<?php
global $_CB_framework, $mainframe;
/**********************************************************
Make sure Community Builder is installed and include the
CB Foundation
http://www.joomlapolis.com/support/tutorials/120-api-usage/18357-including-cb-api-for-usage-outside-of-cb
**********************************************************/
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');
}
/**********************************************************
Include some helpful functions
http://www.joomlapolis.com/support/tutorials/120-api-usage/18357-including-cb-api-for-usage-outside-of-cb
**********************************************************/
cbimport( 'cb.database' ); //Database functions
cbimport( 'cb.snoopy' ); //Snoopy functions
cbimport( 'cb.imgtoolbox' ); //Image toobox functions
cbimport( 'cb.html' ); //Class and plug-in functions
cbimport( 'cb.plugins' ); //Plug-in functions
/**********************************************************
Establish the CB $user object
http://www.joomlapolis.com/support/tutorials/120-api-usage/18359-establishing-a-cb-user-object
**********************************************************/
Global $_CB_framework;
$myId = $_CB_framework->myId();
$cbUser =& CBuser::getInstance( $myId );
if ( ! $cbUser ) {
$cbUser =& CBuser::getInstance( null );
}
$user =& $cbUser->getUserData();
/**********************************************************
Make the button based on the value of field1
**********************************************************/
if ($user->cb_field1 == "Single")
{
echo "<form action=\"http://www.mysite.com/single.htm\">";
echo "<input type=\"submit\" value=\"Buy Passes\">";
echo "</form>";
}
elseif ($user->cb_field1 == "Couple")
{
echo "<form action=\"http://www.mysite.com/couple.htm\">";
echo "<input type=\"submit\" value=\"Buy Passes\">";
echo "</form>";
}
elseif ($user->cb_field1 == "Business Lunch")
{
echo "<form action=\"http://www.mysite.com/businesslunch.htm\">";
echo "<input type=\"submit\" value=\"Buy Passes\">";
echo "</form>";
}
?>
Please Log in to join the conversation.