Posted by: salahuddin66 | July 17, 2007

configure phpbb with wordpress

Today I got success to configure phpbb with wordpress.

It will enable the phpbb registered user to login the wordpress blog (after get approve from admin) with same id and password.

I tried with phpBB-2.0.22 and wordpress-2.2.1

Simply after install both in a same database.

create a connections.php in the includes directory of the phpbb

connections.php

<?php
$con = mysql_connect(“localhost”,”your_username”,”your_password”);
if (!$con)
{
die(‘Could not connect: ‘ . mysql_error());
}
mysql_select_db(“your_database”, $con);
?>

edit includes/usercp_register.php of the phpbb

around 630 lines you will find some line like this

/ Get current date
//
$sql = “INSERT INTO ” . USERS_TABLE . ” (user_id, …);

Bellow this line add

// added by salahuddin66

include_once(“connections.php”);

$query = “INSERT INTO wp_users (user_login, user_nicename, display_name, user_pass, user_email, user_registered) VALUES (‘” . str_replace(“‘”, “””, $username) . “‘, ‘” . str_replace(“‘”, “””, $username) . “‘, ‘”. str_replace(“‘”, “””, $username) . “‘, ‘” . str_replace(“‘”, “””, $new_password) . “‘, ‘” . str_replace(“‘”, “””, $email).”‘, NOW() )”;

if (!mysql_query($query,$con))
{

die(‘Error: ‘ . mysql_error());
}
// finish added by salahuddin66

done..

Now the users will register for the phpbb forum will also register for the wordpress blog automatically.

To enable his wordpress account, wordpress admin need to give him approve/some role.

Categories