Skip to:
Content
Pages
Categories
Search
Top
Bottom

importing bb_users into wp_users

  • @cweb

    Member

    I saw the post at http://bbpress.org/forums/topic/323?replies=11#post-1569

    It seemed to get derailed into some other topic though. Here’s the scenario:

    – WordPress has been up and running with a few users (not many)

    – admin gets bright idea to convert phpbb to bbpress and integrate everything

    – bbpress conversion from phpbb goes okay, all 300+ users can login fine.

    – admin wants to merge these users with the WordPress wp_users table, so they can add comments to WP, subscribe, etc.

    The bbpress sync plugin at http://bbpress.org/documentation/integration-with-wordpress/ works the exact opposite, it merges WP users into bbpress!

    This leaves those of us who took the plunge into converting from a phpbb type platform… stranded! It’s probably just a few SQL queries away from working, right?

Viewing 7 replies - 1 through 7 (of 7 total)
  • @wittmania

    Member

    I had the same epiphany as you did when I learned that bbpress existed.

    Here’s what I did:

    1. I looked at the currently registered users in WP (I only had a few) and noted their numeric ID numbers. I then went over to my phpbb database to see which users they would conflict with (i.e. which ones had the same unique numeric ID number).

    2. I used a phpbb mod which allowed me to go into these users’ profiles and change their ID (not their name) to a number that would not conflict with the WP users, or any other user in the DB.

    At this time, phpbb.com is having trouble with their mod downloads, so I just uploaded the mod file to my own server. You can view the complete mod here:

    http://www.wittmania.com/change-user-id-mod.txt

    It takes about 10 minutes total to make all of the changes. Basically, what it does is add a field to the user’s profile when viewed by an administrator. In this field you can change their ID number to whatever you want it to be.

    So, once the mod has been implemented, go through and change the ID number for whichever users conflict with your existing WP users.

    3. Once you have gotten rid of all user ID conflicts, download Jaime GÓMEZ OBREGÓN’s incredible phpbb to bbpress importer, which can be found here:

    http://www.iteisa.com/phpbb2bbpress/

    You will need to edit the file so that it reflects your DB permissions for both the phpbb and the bbpress databases. Also, if you are running a WP integrated installation (as you obviously are), you will need to change the prefixes for a couple of tables further down in the code.

    Change lines 172 and 173 from:

    $bbpress_tables['users'] = DB_BBPRESS_TABLEPREFIX . 'users';
    $bbpress_tables['usermeta'] = DB_BBPRESS_TABLEPREFIX . 'usermeta';

    -to-

    $bbpress_tables['users'] = 'wp_users';
    $bbpress_tables['usermeta'] = 'wp_usermeta';

    Note: be sure that you use the actual WP table prefix if it is something different than wp_. This change will make the importer put the users into your existing wp_ tables instead of in new bb_ tables, which would defeat the whole point of your import.

    Once you have modified the file, upload it and navigate your browser to it. It should run automatically, importing all of your phpbb info into your bbpress installation.

    4. At this point my memory gets a little fuzzy. In either WP or BBP (or both?), the imported users did not have a role assigned to them. Make sure you check to see what role they are assigned and that it is what you want it to be.

    Of course, before you do anything you should backup your existing WP database, and probably your phpbb database as well just in case. Then, scrap the bbpress tables that you have in the current (broken) installation so the importer has a blank canvas to work with.

    You will also need to install the bbpress integration plugin in WP, which can be found here:

    https://wordpress.org/extend/plugins/bbpress-integration/#post-34

    This plugin will assign the default WP new subscriber role to users who register through bbpress. However, on my blog/forum I changed things around a bit so registrations for both WP and BBP are handled through the WP registration screen. I don’t know why, but I’m just more comfortable with it that way.

    I’m sure as time goes by more plugins from both sides will be developed which will allow for even tighter integration between WP and BBP.

    Good luck!

    @cweb

    Member

    Thank you very much for the detailed response. I’m sure this will help out many folks who have this issue. Let me ponder a lazy man’s approach. That lazy man being me, since I already have said bye to phpbb and have bbpress up and running. Couldn’t I run mysqldump to extract the bb_users table, then go in and modify the first few user ID’s (across the data I know :( ) and then just import that table into wp_users?

    Or since my WP install is still fresh with only a couple users, it might be easier to change their ID’s in the database, then import bb_users into wp_users?

    @wittmania

    Member

    As somewhat of a novice in the mysql world, all I really know is what works for me. However, I do think that your suggestion would work.

    One concern would be that some wp-specific data would be missing from the bbp-only users. Again, I don’t exactly know what that would be.

    I don’t know if there is a quick and easy way to modify the user IDs in WP, since they are going to be associated with posts, comments, and so on. That might be more trouble than it is worth. It might be easier to just create new users in WP and change their ID numbers before they are associated with anything else. Then, delete the “old” users one by one in WP, and each time make sure you set the “Attribute posts and links to:” option to the new, highly-numbered user it should correspond to. At least that way you could add the bbp users in without conflicts.

    There may be a fancy, streamlined way to do this, but I don’t know what it is. :)

    @jessiebirks

    Member

    I’m running into a similar, if not “same” problem.

    I had a PHPBB with approx 20 active users. The same users will be participating in a new page which is pre-launch.

    That page is a WordPress installation with integrated BBPress. There are only 3 users in the WP/BB install. I imported the posts and forums from PHPBB using the PHPBBtoWordpress hack.

    Since I’d already integrated the BBPress install, copying the data did not create the Users in the database, because they began with wp_ and it was looking for bb_. Now, most of the posts are either attributed to “anonymous” or they’re attributed to the wrong username. I don’t want to do the data retrieval over, because the PHPBB users are riddled with spambot entries, and this was an easy way to get rid of them.

    Will it be safe to create my new WordPress users, then edit their ID number to match the IDs from the old PHPBB data? And will this change correctly attribute the posts in the BBPress forums? Also, if I change these ID numbers in the WordPress database… will their posts in WordPress become incorrectly attributed?

    @trent

    Member

    The ID’s not matching up would be the problem. Wittmania’s fix would have it so they stay attibuted to the right users. I have changed users in the past in the database. It sucks. Topic, Post, Users, etc. Too hard with many users, but I did change them with 25 users. Just takes too much time in my opinion!

    Trent

    @jessiebirks

    Member

    Thanks Trent!

    I tested the change on one user, and I was able to edit his ID number to match the number from the old PHPBB. As hoped, his posts in the transferred Forum are now correctly attributed.

    However, I ran ino a quirk. When I change the ID in WordPress, the user gets bumped in the User Role list. He went from “Subscriber” to “No role for this blog.” I manually promoted him to Author from the wp-admin/users panel.

    What field in the wp-db controls the user roles? Can I avoid this quirk on future ID edits?

    @wittmania

    Member

    The reason that happened is that the user roles are stored in a separate table. If it is an integrated site, they are in wp_usermeta (or bb_usermeta if not integrated) where the meta_key is bb_capabilites and the meta_value is the capabilities assigned to them. I have no idea what the syntax for these capabilities is. However, if you wanted you could go into the database and search for the user ID that you are changing, and just change it there. Otherwise, reassigning the role might be just as easy, though it will still leave the record in the usermeta DB for that ID number, which might cause some problems. Unfortunately, there just isn’t an easy way to do this. :(

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar