Home
In Development
Integrating Joomla! and SMF
Integrating Joomla! and SMF
I used the J2smf component from GMITC.
I modified the advanced.php to create an smf_member if no corresponding smf_member exists for the registered Joomla! user visiting the forum.
I had to modify the LogInOut.php to know what to do with the Joomla! password and salt.
Now it works like a champ! A registered Joomla! user who logs in and browses to the forums is silently logged in. If no corresponding forum account exists, one is created for the user. If a registered Joomla! user is not logged in and browses to the forums, and logs in through the forum login screen, he is silently logged in to Joomla!
advanced.php:
// Check if we should log out the current Joomla user
if ( $j2smf->shouldEnforceIntegratedLogin() ) {
// Call the logout routine
$user =& JFactory::getUser();
$pwd = $user->password;
$p = strtok($pwd, ":");
$s = strtok(":");
$query = "INSERT INTO `smf_members` (`ID_MEMBER`, `memberName`, `dateRegistered`, `posts`, `ID_GROUP`, `lngfile`, `lastLogin`, ";
$query .= "`realName`, `instantMessages`, `unreadMessages`, `buddy_list`, `pm_ignore_list`, `messageLabels`, `passwd`, `emailAddress`, ";
$query .= "`personalText`, `gender`, `birthdate`, `websiteTitle`, `websiteUrl`, `location`, `ICQ`, `AIM`, `YIM`, `MSN`, `hideEmail`, ";
$query .= "`showOnline`, `timeFormat`, `signature`, `timeOffset`, `avatar`, `pm_email_notify`, `karmaBad`, `karmaGood`, `usertitle`, ";
$query .= "`notifyAnnouncements`, `notifyOnce`, `notifySendBody`, `notifyTypes`, `memberIP`, `memberIP2`, `secretQuestion`, `secretAnswer`, ";
$query .= "`ID_THEME`, `is_activated`, `validation_code`, `ID_MSG_LAST_VISIT`, `additionalGroups`, `smileySet`, `ID_POST_GROUP`, ";
$query .= "`totalTimeLoggedIn`, `passwordSalt`) VALUES (NULL, '" . $user->username . "', '0', '0', '0', '', '0', '" . $user->name . "', '0', '0', '', '', '', '" . $p . "', '" . $user->email . "', '', '0', '0001-01-01', '', '', '', '', '', '', '', '0', '1', '', '', '0', '', '0', '0', '0', '', '1', '1', '0', '2', '', '', '', '', '0', '1', '', '0', '', '', '0', '0', '" . $s . "')";
$db =& JFactory::getDBO();
$db->setQuery($query);
$result = $db->loadObject();
if ($db->getErrorNum()) {
JError::raiseWarning( 500, $db->stderr() );
}
$smfid = $db->insertid();
//j2smf_logout();
//$message = "Attempting to create SMF user with query: " . $query;
//j2smfBridge::logDebug($message);
}
LogInOut.php
around line 273:
// Figure out the password using SMF's encryption - if what they typed is right.if (isset($_REQUEST['hash_passwrd']) && strlen($_REQUEST['hash_passwrd']) == 40)
{
// Needs upgrading?
if (strlen($user_settings['passwd']) != 40)
{
$context['login_error'] = $txt['login_hash_error'];
$context['disable_login_hashing'] = true;
// return; // jnodwell don't return here go check if this is a Joomla! user
}
// Challenge passed.
elseif ($_REQUEST['hash_passwrd'] == sha1($user_settings['passwd'] . $sc))
$sha_passwd = $user_settings['passwd'];
else
{
$_SESSION['failed_login'] = @$_SESSION['failed_login'] + 1;
if ($_SESSION['failed_login'] >= $modSettings['failed_login_threshold'])
redirectexit('action=reminder');
else
{
log_error($txt[39] . ' - <span class="remove">' . $user_settings['memberName'] . '</span>');
$context['disable_login_hashing'] = true;
$context['login_error'] = $txt[39];
return;
}
}
}
around line 331:
elseif (strlen($user_settings['passwd']) == 32){
// vBulletin 3 style hashing? Let's welcome them with open arms \o/.
$other_passwords[] = md5(md5($_REQUEST['passwrd']) . $user_settings['passwordSalt']);
// Hmm.. p'raps it's Invision 2 style?
$other_passwords[] = md5(md5($user_settings['passwordSalt']) . md5($_REQUEST['passwrd']));
// Maybe it's Joomla! style - jnodwell
$other_passwords[] = md5($_REQUEST['passwrd'] . $user_settings['passwordSalt']);
//echo md5($_REQUEST['passwrd']+$user_settings['passwordSalt']);
}
Trackback(0)
TrackBack URI for this entryComments (4)
Subscribe to this comment's feed...
hi, i'm not speak english, sorry
it error ?
...
Could you please pick up the J2SMF bridge and improve it?
I installed J2SMF and SMF 1.1.9 on my Joomla 1.5.12. It can work but can't synchronize users.
It seems that the author of J2SMF had abandoned this project. But I think it has a good foundation.
Could you please pick up J2SMF bridge component and improve it? I am sure there are many users want to use it.
Thank you.
Write comment

Last Updated (Tuesday, 22 July 2008 14:31)





