Migrating from one system to another

My next project involves moving some sites from a now defunct application called Article Manager by Interactive Tools to WordPress. Since this also involves a redesign of the site, there is no need to translate the templates. This will be a data transition only.

Article manager creates flat files from its data. It is not a “live” system like WordPress is. The good part about that is the low database utilization and very quick serving site as all you need is a quick web server. The down side comes from the very limited template language the system uses. There are no variables you can create, very little branch control, very little state you can check. It was quick and relatively simple but in the end too simple for our needs. Interactive Tools has moved on from that product to one they call CMS Builder.

Article Manager (Artman) contains all its data in four tables, one for the articles, one for categories, one for users and one for what it called publish rules. The publish rules are instructions to the system on how the create the flat files. Since those are not needed in WordPress, I can ignore that table. That leaves three.

The first I will convert is the user table. I choose that one because it is referenced from the other two via creator ids and such. Second, I will move the categories and third will be the articles themselves. This will be the most interesting one and will take the most manipulation. I’ll need to update the user ids and category ids. I will also have to decode the way Artman stores image references for articles. Instead of keeping the original link to the images the way WordPress does, Artman had a code system for placing images into the article.

Since I will be doing this conversion more than once, I plan to build a tool to do the job. In the end, I will be combining many sites into one WordPress multisite install.

Changing hosts and WP-United

Just a quick note on an issue that popped up for me when moving a WordPress / WP-United site to a new host. The move was done by the hosting company without the knowledge of the site and its databases. The WP-United / WordPress combination is somewhat specific, so I wouldn\’t have expected them to have much knowledge of it anyhow.

After moving all the data and the databases, a message that it could not connect to the database kept showing on the site. Going directly to the forums however worked. Within the PHPBB control panel, I then emptied the cache. After that, WordPress was able to function again.

HTML 5 possibilities

There are lots of HTML 5 demos out there, but this one is really interesting and innovative. The band Arcade Fire has created a semi-interactive music video using HTML 5, multiple windows, and Google maps. You enter your address and it searches Google maps for that address and includes maps and street view into the presentation. Very creative and technical. I will have to dig and see how it was done.

WordPress Multisite

For a potential project I currently have with WordPress, I need to figure out the multisite feature. With WordPress 3, multisite was included with the base install. It only requires a little configuration to get up and running.

The problem is, multisite doesn’t function quite the way I need for this project. Multisite is designed for use in subdomains or subdirectories. In my case, I need it to work with separate domains. There are a couple of ways to make this work. One is to hack things a bit and the other is to use domain mapping. Domain mapping can be expensive in terms of processor, and since these sites I need to implement are somewhat high volume I deceided to focus on the hacking option instead.

There are some directions here for getting multisite running on separate domains. These directions work, but pay careful attention and follow them completely. If you miss a step you may get unexpected results. I missed the step of inserting the new row into the wp_site table and this resulted with me being unable to log into the second site. Any attempt to log in would just throw you back to the login screen. Inserting that row fixed that problem for me.

There are some caveats to this solution. Under a normal subdomain install, you get a list of sites in the Super Admin panel at the top. With separate domains this list only includes the first site. Something similar happened with a plugin I needed too. I needed the ability to post from one site to another in the multisite install. ThreeWP Broadcast works for this, but under its panel there were no sites listed.

The solution lies in that new row added to wp_site. In that table, there is a blog id and a site id. I guessed that the lists were showing blogs within one certain site id. For the separate domains to work, they needed to have different site ids. I edited the plugin to remove its reference to site id and the other site showed up in its panel. Since that worked, I looked for references to site_id within WordPress files and adjusted them similarly.

Now it all works, mostly. The only thing that does not work as I wish is the Super Admin panel does not show in the admin of the second site. I keep referencing the second site, I only have two sites in multisite currently but I believe all subsequent sites will work the same way. I’d like the super admin panel to show for all super admins no matter which site they are logged in on. I haven’t looked into this too much yet as it would be nice but is not needed for the sites to function.

Now that multisite is working with domains, I have two other issues to work through for this project. The first will be bringing in data from a legacy system into WordPress. The second is integrating VBulletin into WordPress with multisite. Good times ahead!

Future project

With PHPBB integrated into WordPress and looking pretty good, then next challenge will be doing a similar integration with VBulletin. This plugin is supposed to do the job, but does not work with WordPress Multisite, which will likely be a requirement. This is just the initial investigation. Much more to look at.

Cross posting with WP-United

Finally got around to getting cross posting working with WP-United. It was not too difficult once I got over the notion of having PHPBB handle the logins for WordPress. All that was needed was to mark the settings in WP-United to have PHPBB handle the logins, then you enable crossposting and comments. Once that is done, there are some permissions changes that need to be made in PHPBB. Usergroups need to have WP_United permissions added to allow cross posting and comments. Also, the forum into which things will be cross posted needs to be set permissions. That’s all there was to it. Very nice and easy.

Once it was working, there were some changes that needed to be made to the text that is generated for the cross posted items. Some of these changes are in the language file. That is found under the languages/en/mods/wp-united.php file (at least in my case where my forum is English) under your PHPBB install directory. The entries I changed were blog_title_prefix and blog_post_intro.

By default, WP-United puts the blog_post_intro first in the post, then some lines, then the post as either excerpt or full story as selected when cross posted. I wanted the link to the post, which is in the blog_post_intro after the story instead. To change this, I edited wp-united/functions-cross-posting.php. I searched for blog_post_intro in that file to find the relevant line to edit. It was a simple string concatenation and was real easy to change. Now the posts appear as I want.

Model160.com is almost ready to launch now. There are a few more stylistic things to change and there is some odd behavior from time to time that I think comes from WP-United. All those things are related to CSS so I am confident I can get them sorted out.

WP-United and Google sitemaps

This morning I discovered a problem with the Google sitemaps on my site. They were no longer being generated correctly. I’m not sure if that problem existed before I made a change to WP-United or not.

We wanted to have the URL to the site be simply http://www.model160.com and not the default of http://www.model160.com/forums/blog.php. That change was easy enough. All you need to do is copy /forums/blog.php to /index.php, edit the new index.php to add the location of your PHPBB directory, /forums in our case, and then change a setting in the WP-United panel. Once that was done, the site looked the same, which is exactly what I had hoped for.

The problem is, the setting for your home page in WP-United includes the file name, so it looks like http://www.model160.com/index.php in our case. I use a plugin for Google sitemaps called Google XML Sitemaps with qTranslate Support. The problem was it was grabbing the site URL from WP-United and so was attempting to generate the file as http://www.model160.com/index.php/sitemap.xml. Since index.php is not a directory, it didn’t work. All I needed to do was set the path manually to sitemap.xml and the url to http://www.model160.com/sitemap.xml and all was better.

AIR-Box plugin for PHPBB

For the site I’m working on it is likely the forums will have lots of photo posting and those photos could be large. As such, we wanted a way to auto-resize the posted photos but allow access to the full sized photo. Enter AIR-Box.

I tried installing AIR-Box with AutoMod. I kept getting errors. I tried forcing the install. It said the install succeeded, but none of the required changes were present. In the end I manually installed the plugin. I was still having problems.

Part of the problem had to do with WP-United. WP-United removes parts of the PHPBB code in order to avoid having two <head> or </body> tags in the same page. It was cutting off the page at a crucial part for AIR-Box. I moved the code and was still having problems. I found that the class “postimage” was not being attached to the photos. I think this was because I was using a subsilver2 theme in PHPBB and the plugin is made for prosilver or subsilver. I found the template bbcode.html in the subsilver2 style and edited the code there. You need to add both the class="postimage" to the image and a <a> tag with a rel="lightbox" around the image for the effect to work. Once that was complete, the resizing worked. The lightbox still did not work.

I edited the airbox.js file and added some javascript alert calls to see what was happening. It seemed as though the mootools being used wasn’t working for some reason. AIR-Box uses a free lightbox script called slimbox, so I went there to see what they had. There was a new version and a separate version that used jQuery instead of mootools. I downloaded that version and substituted that into airbox.js. At last I had success.

WP-United

Yesterday I decided to take a different tact with the WordPress / PHPBB integration. I installed AutoMod into PHPBB and used that to install WP-United. This time, I had no issues. I remembered to deactivate all the plugins first which was probably the cause of my issues in the first place.

Not too much to talk about this time as the install worked exactly as I would have hoped it would. Things seem functional for now. As of now, I have PHPBB running inside WordPress. My next steps will be to figure out how to better integrate things and to try some of the cross posting features. I would also like to investigate using PHPBB as the comment system for WordPress.

WordPress and PHPBB integration

For a site I’m working on, I need to integrate PHPBB into WordPress. There are a few solutions for this out there but WP-United seems to be the one that is cited most. As such, it’s the first I’ll work on.

I attempted this integration last week with no success, but I must admit that I tried to rush it and should have taken a different tact. I got the PHPBB side uploaded and manually edited the files according to the install XML file. After getting all the files edited, I tried running the setup wizard and got lots of error messages. Most of the messages were about duplicate function definitions and a couple of duplicate class definitions. To fix these, I added if (function_exists("FUNCTION NAME HERE")) { blocks around the offending functions and if (class_exists("CLASS NAME HERE")) { around the classes. It was quite repetitive and annoying. So much so, I looked into creating macros for my favored editor jEdit. The macro worked well and saved tons of time, but the solution was a poor one for the real problem.

Once that was all done and the errors stopped showing, I tried the setup wizard again. The main way wp-united likes to work is to display WordPress within PHPBB. I wanted to go the other way as the site already had a lot of work done to change the appearance. I aborted the wizard and just filled in the settings on the settings page. In the end, something was not done correctly and the site and no longer functioned.

I think one of my critical mistakes was I did not disable my WordPress plug-ins before installing. Before editing the files the first time I had made a tar backup of the site, so I was able to get things working again pretty easily. I intend to try again, this time using AutoMod on PHPBB and disabling plug-ins before installing. As I write this, WP-United.com is not responding, so I am unable to try again for the moment. As soon as it is available again, I will retry the install.

I should note that I am using WordPress 3 on this site and WP-United is not yet updated for WordPress 3. There are some instructions for allowing it to run, but I expect some problems.