Skip to:
Content
Pages
Categories
Search
Top
Bottom

Successful Reverse Integration Steps

  • Today I did the reverse integration of an existing WordPress blog (2.7.1) and BBPress forum (0.9.4). I described my plans here. With some help from bobbyh and a lot of digging into these forums, things worked out well.

    Here are the steps (all but the final 2 are database operations, which I did using phpMyAdmin):

    1. I didn’t need to do backups because I was using a test site, but if you are trying this, don’t go any further without full backups of everything.
    2. Copied the “bb_users” and “bb_usermeta” tables from the BBPress database to the WordPress database. I was a bit worried that the row sizes weren’t exactly the same in the destination copy, but as it turns out, that wasn’t an issue.
    3. Added a “user_activation_key” field to the copy of “bb_users” to ensure that the schema matched my current “wp-users” table in the WordPress database.
    4. Renamed the “wp_users” and “wp_usermeta” tables to “wp_users_old” and “wp_usermeta_old” respectively.
    5. Renamed the new “bb_users” and “bb_usermeta” tables to “wp_users” and “wp_usermeta” respectively.
    6. Added WordPress admin rights and metadata to the new admin user. To do this I ran the following query:

      INSERT INTO wp_usermeta (user_id, meta_key, meta_value) VALUES (‘1’, ‘wp_capabilities’, ‘a:1:{s:13:”administrator”;b:1;}’);

    7. Added WordPress user metadata for the rest of the users (since I’m using the BBPress user tables as the starting point they know nothing about WP capabilities). Here is the query:

      INSERT INTO wp_usermeta (user_id, meta_key, meta_value) SELECT user_id, ‘wp_capabilities’ AS meta_key, ‘a:1:{s:10:”subscriber”;b:1;}’ AS meta_value from wp_usermeta WHERE user_id NOT IN (SELECT user_id from wp_usermeta WHERE meta_key = ‘wp_capabilities’) GROUP BY user_id;

    8. Changed the user_id references in the “wp_posts” and “wp_comments” tables so that they pointed to the correct users (you need to do this because equivalent users don’t necessarily have the same ID in the previously separate WordPress and BBPress databases). Here are the queries I ran:

      UPDATE wp_posts SET post_author=NEW_ID WHERE post_author = OLD_ID

      UPDATE wp_comments SET user_id=NEW_ID WHERE user_id = OLD_ID

      NOTE that you need to think carefully about the order in which you do these changes. You don’t want to change a user’s ID to one that already exists in the WordPress table.

    9. Installed superann’s plugin to downgrade WP 2.7.1’s cookie handling for compatibility with BBP 0.9.4: http://superann.com/2009/02/26/wordpress-26-27-bbpress-09-cookie-integration-plugin/
    10. Told BBPress to find its user data in the new WordPress user tables. This is done in the BBPress admin page for WordPress integration: […]/bb-admin/options-wordpress.php. You need to follow the instructions carefully. In particular, note that the WordPress database secret should be copied from the current WordPress setting and not vice versa.

    Some other notes:

    • This is not something to do in a rush. I checked the results of each step carefully before moving on. This included browsing the database and, later in the process, logging in to the blog and forum to check whether things were working as expected.
    • This worked for me. Your mileage may vary.

  • You must be logged in to reply to this topic.
Skip to toolbar