Integrating WordPress & Vanilla [with Existing Content]

If you’ve googled “WordPress Vanilla integration” then I’m sure you’ve come across the instructions on the Lussumo website. Thanks to them for taking some time to write that up! Unfortunately, that is no longer sufficient because it documents integrating WordPress 2.0.4 and Vanilla 1.0.1. At the time of writing this entry, WordPress is at 2.5.1 and Vanilla is at 1.1.4. In addition, every tutorial or bit of info that I’ve found has made the assumption that everything is starting out fresh and new. That makes it almost easy as cake! However, that doesn’t entirely work for me since I already had both WordPress and Vanilla installed, with users and content – functioning independently.

I want to try to summarize all of the steps that I took in an effort to help anyone out there that’s looking to do this, as well as to document it for myself in the event that I need to do this again in the future. These steps are all specific to my circumstances – which are probably not all that common. However, maybe this can serve as a solid starting point and give ideas on what to think about.

My situation:
I was running WordPress 2.5.1, Vanilla 0.9.6(?) (shame on me for not staying up to date!) with 1 WordPress user, and a handful of Vanilla users. I did NOT have any subdomains setup (I believe this may affect the cookies). I was in the process of moving my website to a newer server and figured that I might as well use this as an opportunity to get things setup properly, integrated, and up to date.

The steps I took were probably NOT the most efficient because I was/am still learning. I’m sure that if you have the knowledge, you could script much of this – and I know the Vanilla/WordPress community would very much appreciate something along those lines.

It’s important to keep in mind that each user, blog post, forum category, comment, etc., each have their own incrementing ID#s that will need to be taken into account when planning your upgrade/migration. Those IDs all correspond to each other, and depending on your situation you may need to import your data in a different order than I have to make things easier for yourself. We’ll come back to this later.

I was starting fresh on my new server which proved to make most things easier. The files on my old server were unusable as they were, so monkeying with the databases didn’t affect anything (just make sure you make frequent backups before/after you do anything – just in case…!). The Vanilla upgrade instructions from 0.9x to 1.1.4 weren’t very thorough, so I kind of worked around them.

I followed the instructions from the Lussumo website here and had to make some adjustments to make everything play well together and work. Here’s a summary with some notes and extra steps, but be sure to read through the Lussumo instructions too.

Be sure to read through everything before starting in the event that you need to change the order of some steps to accommodate your situation.

  1. If you’re starting with an older version of Vanilla you’ll need to prep the database. There’s a command that the upgrade script may say that you need to run depending on the version you’re coming from. I wasn’t able to find it in the Lussumo upgrade instructions (and I forgot to capture it during the process. Start the upgrade script and run the sql command if instructed, but stop there.
  2. It’s probably best to start fresh. If you have pre-existing installs, backup your databases and drop the tables before starting.
  3. The Lussumo instructions recommend installing WordPress first. I’ve found that this may “randomly” give you “500 Internal Server Error”s when attempting to install Vanilla after WordPress. For less of a headache, switch the install order and install Vanilla first.
  4. Here’s a tip: Set your “throw-away” Vanilla admin account username and password to something different than you’re going to set for WordPress. This will help with troubleshooting in the future if you have problems logging in.

  5. Install the latest version of WordPress.
  6. During the install, I specified a custom table prefix. I would recommend doing this as well. If you do this, make note of the custom prefix for later steps.

    Note that if you need, you can put WordPress in its own folder while keeping your root directory clean. See more info here. Although, this seemed to cause problems with my integration. I think it had something to do with the cookie path because the forum folder no longer resided inside where WordPress was located…(?) so I skipped this particular step.

  7. Setup the secret key! This is new in WordPress, so this information is not in the Lussumo instructions. Check here or here for more info. I updated the WordPress wp-config.php file as well as the Vanilla conf/database.php file – but I did NOT update the WordPress “options” database table!
  8. Now would be a good time to setup some security precautions while everything is new and easier to modify. The WP Security Scan plugin can help. Change your WordPress database table prefix (as mentioned previously), rename your WordpPress Admin user account, etc.
  9. Tell Vanilla to use the WordPress user table by updating the conf/database.php file. If you set a custom prefix, make sure to make the necessary adjustments to the instructions to accommodate that.
  10. Run the query to add the Vanilla-specific columns to the WordPress user table.
  11. Leave out the line to add the ‘Email’ column. I’ve found that this isn’t used – perhaps it was at one time. Note that the previous step directs Vanilla to use the already-existing WordPress ‘Email’ column, so why add another one into the mix? If you already have a database backup that has this column in it, then you can leave it – and maybe remove it after your data import.

  12. Create the People/People.Class.WordpressAuthenticator.php to setup the authentication. However, follow the instructions from this thread to do so.
  13. Update the Vanilla conf/settings.php file to use the new Authenticator. Also comment any lines that refer to the old “LUM” user table if it exists.
  14. Run the SQL command to set the WordPress Admin account to be the Vanilla administrative account, or just update the value manually.
  15. Ok. You’re most of the way there now.

  16. Make sure you can login to WordPress, and then stay logged in when you navigate to your forum. If not, check the Vanilla cookie domain, the authenticator, and the secret key in the wp-config.php file and the database.php file all match. At this point you should be able to stay logged in on the forum, and be able to browse around as the admin. I have not yet gotten the Vanilla login page to work. That is still in progress.
  17. Once that was done, I had to import my database tables. If you’re fluent enough, you can probably just do this all at once with a large database import. I prefer to do this in steps so if something breaks, I’ll know where to start looking.

  18. First, setup the basic structure that the rest of the data relies on. Import the categories, tags, roles, etc.: LUM_CategoryRoleBlock, LUM_Category, LUM_Role, and wp_terms. You can do this by copying the appropriate lines that say “INSERT INTO” from the sql backup file, and pasting them into the sql command field in phpmyadmin. Don’t forget to adjust the table names as necessary.
  19. Browse to the forum as the admin and confirm that the roles and categories exist. Do the same for the WordPress tags.
  20. Once that was setup, I opened the sql file and literally copied and pasted the data for the forum user accounts into the corresponding cells of the new users table. If you can script this – even better.
  21. I really only had user accounts on the forum, so I transferred that data over to become the new hybrid user accounts. This will be more complicated if you had a number of different user accounts in both WordPress and Vanilla.

    User ID#’s are important! If you import a user with an ID of “2” into the database as user with an ID of “5”, then all of the associated posts will point to the wrong user! This also means that whatever the user ID is for your WordPress admin account, this will also be the Vanilla admin account. So plan this part carefully.

    Also important! WordPress does not allow users to change their usernames, while Vanilla DOES! I’m not sure how this will affect WordPress if a user attempts this…

  22. Next, WordPress has a second “_usermeta” table. You’ll need to populate this as well. This stores things like First & Last name, WordPress access type, nickname, etc. I don’t yet know how to redirect Vanilla to use this information, so there’s some data duplication. If your users update particular pieces of information, they may need to do it for both applications.
  23. Again, perform a search for * users on the forum and make sure that everyone appears as they should. Open the WordPress Dashboard and browse the users to ensure that they look correct with the appropriate access as well.
  24. When the user accounts are all imported, then you can begin importing the WordPress blog entries, WordPress pages, and the Vanilla discussions using the same method as the structure items above (wp_posts, wp_term_relationships, and LUM_Discussion).
  25. After the blog entries, pages, and discussions are imported, then you can import the comments & replies (wp_comments and LUM_Comment).
  26. If you want to carry over the Vanilla user IP history or the WordPress post edit history, you can do that now (LUM_IpHistory, wp_postmeta). I did some pruning to keep the database size manageable.
  27. Don’t forget any links that you might have had setup in WordPress (wp_links).

I think that was it! Easy, huh?