如何在单个实例中集成drupal 7和phpbb3论坛

时间:2016-01-29 12:32:15

标签: drupal-7

我想将phpbb3论坛DB和drupal DB集成到同一个DB中。

例如:

Drupal           phpBB

0 Anonymous      1 Anonymous 
1 Admin          2 Admin

两者都应该具有相同的ID,用户必须能够使用他们的phpBB凭证在Drupal中进行身份验证。

1 个答案:

答案 0 :(得分:1)

如何将phpBB与drupal集成,共享用户但使用phpBB作为论坛。 2006年1月16日下午6:48由solipsist发布。

我找到了一种方法,所以这是一套简短的说明。这个解决方案远非完美,也不是我的指示,但我希望它对那些想要做同样事情的人有用,即使用他们的旧phpBB用户列表与Drupal并仍然保持phpBB作为留言板。

You'll need the following:
Arne Kepp's module, found here: http://drupal.org/node/32818
An existing phpBB forum
A Drupal installation
BEFORE YOU START: Make backups of your phpBB and your Drupal databases!
Start by reading the README that comes with the module above, do so very carefully.

The module sorts everything apart from importing old users from phpBB to Drupal. This was I had to figure it out for myself. This presents a problem as both Drupal and phpBB makes the first user admin however they have different IDs (IDs or UIDs are used to indentify records in a db table), as illustrated below:

Drupal --------- phpBB
                 -1 Anononymous
0 Anonymous
1 Admin
                 2 Admin
In order to import your phpBB users to Drupal, run the following SQL query (in phpMyAdmin for example), this one is from Feodor's migration script:

INSERT INTO <your_drupal_database_name>.users (uid,name,pass,mail,mode,sort,threshold,theme,signature,created,changed,status,timezone,language,picture,init,data)
  SELECT  user_id,username,user_password,user_email,0,0,0,'',user_sig,user_regdate,user_lastvisit,1,0,'',user_avatar,user_email,'a:1:{s:5:"roles";a:1:{i:0;s:1:"2";}}'
  FROM <your_phpbb_database_name>.phpbb_users
  WHERE user_id>=@first_phpbb_user_id;

You have to replace @first_phpbb_user_id with the ID of the first phpBB user, usually 2
Then add all users you just added to the users_roles junction table, this matches a user and his/her role so that a user can have more than one role:
INSERT INTO `users_roles` (uid)
  SELECT  uid
  FROM jakobp_drupal.users
  WHERE uid>=3;
Now run this query, this will set the role of every registered user as "authenticated":
UPDATE `users_rules` SET rid =2 WHERE uid > 0;
(I am sure you can combine the last two queries into one but I haven't had time to figure that out yet. :))
You might have noticed that the phpBB admin account is unchanged. You will from now on use your Drupal admin account for both your forums and your Drupal installation. I think it would be better to find a way to merge the accounts or allow both to be used but this is a limitation in the module.
We're almost done. You need to change the auto_increment value of the two user tables. The auto_increment value affects the value of the id field of new records. We will want these values to be identical or the two user tables will not be synchronized. The new auto_increment value should be high, you can check the id of the last user to see. I recommend adding 1000 to it. In the unlikelihood that you just deleted a few hundred users from your table, the actual increment value will be higher than the last value you see.

To do so, execute these SQL queries where X is the new increment value:
ALTER TABLE phpbb_users AUTO_INCREMENT = X;
ALTER TABLE users AUTO_INCREMENT = X;
We also need to update the last UID value, Drupal uses this to keep track of the last UID added to the users table, same applies here, replace X with the new increment value:

UPDATE `sequences` SET `id` = 'X' WHERE `name` = 'users_uid' LIMIT 1;

现在应该对它进行排序。如果您有任何问题,请随时发布。