I was just working on a site where i have to integrate phpBB3 and wordpress, i tried searching for things on internet but was not able to find a simple and feasible solution for the problem, so i thought of diving into the code and get things working on my own, and wow i got success. Here are the function that you should call to start a phpBB and WordPress session.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | function authenticateForumAdmin($username, $pass)
{
global $dbObject, $user, $auth, $db;
$loginDetails = $auth->login($username, $pass, false, 1, 1);
if($loginDetails["error_msg"] != "")
{
return false;
}else{
return true;
}
}
function wp_authentication($username, $pass)
{
global $_POST, $_COOKIE;
if (function_exists('get_userdatabylogin')) {
$user = get_userdatabylogin($username);
if (! $user or $username != $user->user_login) {
if ((bool) get_option('http_authentication_auto_create_user')) {
// Create user and re-read from database for login (next step)
$this->create_user($username);
$user = get_userdatabylogin($username);
}
else {
// User is not in the WordPress database, and thus not authorized
die("User $username does not exist in the WordPress database");
}
}
// Login the user by feeding WordPress a double-MD5 hash
$password = md5($user->user_pass);
// User is now authorized; force WordPress to use the generated password
$using_cookie = true;
wp_setcookie($user->user_login, $password, $using_cookie);
}
else {
die("Could not load user data");
}
} |
I am still looking for a single sign-on solution for phpBB3 and WordPress. Will post here once i am done with it.

