Tender and Joomla Integration Guide
Thursday, 16 December 2010 17:36
One of the most important things here at Simplweb is our customer support. as well as all the usual Joomla hosting questions, we also offer unlimited support for any and all of your Joomla questions. To make sure we deliver this at the highest possible quality and speed, we choose to use Tender support and set up a Tender and Joomla integration.
To make things even easier for customers, we have used Tender's Single Sign On (SSO) feature. When you are signed into www.simplweb.com, all the links to the Joomla support pages will be pre-authenticated - no additional login.
This isn't too hard to set up, here is how we did it.
First in the head of the template, you have to grab the user information out of Joomla
<?php $user =& JFactory::getUser(); ?>
Next, also in the head, you have to build the JSON encrypted tokens for the TenderApp multipass.
<?php
$account_key = 'PUTYOURACCOUNTNAME?URLHERE';
$api_key = 'PUTYOURAPIKEYHERE';
$salted = $api_key . $account_key;
$hash = hash('sha1',$salted,true);
$saltedHash = substr($hash,0,16);
$iv = "OpenSSL for Ruby";
// use an expires date in the future, of course
$user_data = array(
"email" => $user->email,
"name" => $user->name,
"unique_id" => $user->id,
"alternate_id" => $user->email,
"expires" => date("Y-m-d H:i:s\Z", strtotime("+30 minutes")),
"tender_usersite" => '$user->username'
);
$data = json_encode($user_data);
?>
<?php
// double XOR first block
for ($i = 0; $i < 16; $i++)
{
$data[$i] = $data[$i] ^ $iv[$i];
}
$pad = 16 - (strlen($data) % 16);
$data = $data . str_repeat(chr($pad), $pad);
$cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128,'','cbc','');
mcrypt_generic_init($cipher, $saltedHash, $iv);
$encryptedData = mcrypt_generic($cipher,$data);
mcrypt_generic_deinit($cipher);
$encryptedData = base64_encode($encryptedData);
?>
Now all you have to do is to put a link to support somewhere. It has to be in the TEMPLATE index.php, so if you are using a menu, you'll need to hard code it.
<?php $user =& JFactory::getUser(); if( !$user->guest ): ?> <a href="http://support.simplweb.com?sso=<?= urlencode($encryptedData) ?>">Support</a> <?php endif; ?> <?php if( $user->guest ): ?> <a href="http://support.simplweb.com">Support</a>
You can see we are using a quick conditional statement so we don't get a messy link when the user is not logged in. That's all there is to it.
Just another way Simplweb is providing the best Joomla website support out there!

Sign up at Simplweb and we'll send you a free signed copy of the best-selling Joomla - A User's Guide when your subscription starts!