Infusionsoft Test
Welcome to Narrowbudget, the world’s only budget calculator designed specifically for narrowboat owners. It’s the only resource you need to determine once and for all what costs you’re likely to incur when both buying and maintaining your narrowboat.
[insert_php]
// Get the user’s email address.
global $current_user;
get_currentuserinfo();
$userEmailAddress = $current_user->user_email;
if ( is_user_logged_in() )
{
// User is logged in so load up the Infusionsoft SDK.
require_once( $_SERVER[“DOCUMENT_ROOT”] . “/infusionsoft_sdk/isdk.php”);
$myApp = new iSDK;
// By default access to Narrowbudget Gold is denied.
$goldAccess = false;
// Try to connect to Infusionsoft …
if ($myApp->cfgCon(“connectionName”))
{
// Success – so lookup the user by email address to get their Contact ID.
$contacts = $myApp->findByEmail($userEmailAddress,array(‘Id’));
// Now use the Contact ID to return the list of tags assigned to the contact.
$returnFields = array(‘GroupId’);
$query = array(‘ContactID’ => $contacts[0][“Id”]);
$tags = $myApp->dsQuery(“ContactGroupAssign”,150,0,$query,$returnFields);
// Loop through the tags looking for “111” (Narrowbudget Gold).
foreach( $tags as $tag )
{
// “Group” is – apparently – the old term for “Tag”. Group ID 111 is Narrowbudget Gold.
if ( $tag[“GroupId”] == “111” )
{
// Found it so flag it up and stop looking.
$goldAccess = true;
break;
}
}
}
// Show the Gold or Standard links as appropriate.
if ( $goldAccess )
{
echo “Click here to log in\">Launch Budget Application – Gold Version
“;
echo “
Downloads
“;
echo “Quick Start Instructions – PLEASE READ FIRST
“;
echo ““;
echo “Living on a Narrowboat: The REAL Cost of a Life Afloat
“;
echo “Living on a Narrowboat: “;
echo “21 Liveaboard Case Studies
“;
echo “Narrowbudget Cheat Sheet
“;
}
else
{
echo “Launch Narrowbudget Application – Standard Version
“;
echo “
Downloads
Quick Start Instructions – PLEASE READ FIRST
“;
}
}
else
{
// User isn’t logged in …
echo “You aren’t currently logged in to the site so you can’t see the link below”;
echo “If you are already a site subscriber, “;
echo “please log in here. If you aren’t yet a subscriber and you would like to use the application”;
echo “, you can “;
echo “find out more about it and register here.”;
}
[/insert_php]