[insert witty title]

Futile. Like a hamster running in its wheel

Entries Comments



How to Import b2evolution Posts to Wordpress

27 May, 2007 (12:48) | Site Stuff | By: cmb

There already exist PHP scripts that can import b2evolution databases into a Wordpress blog, but I personally did not find them to be a satisfactory solution. This is due to the fact that the version of the PHP script you require depends critically upon both the version of b2evolution you are running and also the version of Wordpress into which you are importing (the script has currently not been updated in nine months and is incompatible with all recent b2evolution installs). Additionally it is necessary to install b2evolution and Wordpress into the same database, which is not easy if you are, for example, importing your posts into an already existing blog, or moving site entirely. Finally I don’t really understand databases and as such don’t feel happy in running a script I found on the internet to make massive changes, since if something goes wrong I do not stand a chance at fixing it.

Here I present a method that should work on all versions of Wordpress and all relatively recent b2evolution installs. You will not need to mess around with databases since we use an alternative approach. We are going to skin b2evolution in such a way that if you look at the source of a webpage it appears in a simple format that Wordpress can import, the Movable Type ASCII export format. With no further ado here are the three easy steps you need to perform to move your posts and comments from b2evolution to Wordpress:

1. Apply a new skin to b2evolution

BACKUP YOUR CURRENT SKIN. I’m not responsible if you forget to do this and then change your mind about moving over. Copy the following files over your current theme:

replace _main.php with the contents of _main.php.txt
replace _feedback.php with the contents of _feedback.php.txt

If you now view the blog in a browser it will look like a bit of a mess, but if you view the source of the page (click View > Page Source in your browser) it is in Movable Type ascii export format, which you can import directly into a new (or old) Wordpress install!

2. Download your old blog to text files

I found that the easiest way to grab a whole lot of posts at once was to view the archive page for a whole year, with the display of comments enabled. For example if your blog resides at http://www.mydomain.com/blog/ then the page that will show you all of the posts and comments for the year 2007 is at:

http://www.mydomain.com/blog/index.php?m=2007&c=1

View the source of this page (View>Page Source in your browser) then copy and paste it into a text file. Repeat this step for every year of posts you need to import.

3. Import the text files to Your New Blog

Wordpress

New versions of Wordpress can import directly from the admin control panel, just click “Manage>Import>MovableType and TypePad”. Upload your text files and click import. Older versions of Wordpress already have well written instructions on this page.

Typepad

I have heard that this works, but do not know how to do it…

Bugfixes For Older Software Versions

b2evolution 0.9.0

“author()” isn’t recognized by this version (or at least, the blog I am working with), but if it is replaced with “Author->prefered_name()”, everything works out fine! (thanks Layne)

Questions, comments and criticisms are, as always, welcome below.

Comments

Comment from Max
Time: May 30, 2007, 9:39 pm

The new blog is nice!

But now that you’ve got multiple people posting, could you put an ‘author’ field somewhere?

Comment from Nishanthe
Time: June 3, 2007, 8:49 am

Thank you very much. You saved my day :)

Pingback from Glimpse of Nish’s World » Blog Archive » From b2evolution to wordpress
Time: June 3, 2007, 8:56 am

[...] to migrate from b2evo to WP. Many things need to be done manually. I used the method explained in here to import the blog posts and coments. But that was really not a smooth [...]

Comment from cmb
Time: June 3, 2007, 9:38 am

Max: Thanks!

Also I just added the author tag, but it seems that everybody else has given up posting once again.

Comment from Adam’s Blog
Time: June 15, 2007, 6:32 pm

when we tried this, it worked fine, except all the posts (230 of them in that round) showed up as drafts in wordpress (they were published on b2evolution) Any advice?

Comment from cmb
Time: June 16, 2007, 11:09 am

Oops, in _main.php after the line containing “… DATE: ….” add a new line:

echo “STATUS: publish\n”;

Sorry about that!

Comment from Adam’s Blog
Time: June 19, 2007, 11:30 pm

Thanks. Just glad we got that bug fixed (and that I spotted it BEFORE I saved all those files without that line, and before 5000 posts went up as drafts . . . *shudders just at the thought* Now it seems to work fine, and in my guessing at what the problem was before you posted this, I actually got the missing code right, but put it after category, and WP still recognized it and actually published my import files :)

Pingback from Importing b2evolution to Wordpress - Business Forums
Time: July 10, 2007, 9:52 pm

[...] script - just used this - piece of cake - though remember to rename those .php.txt files to .php How to Import b2evolution Posts to Wordpress - I tried using this, but I couldn’t get it to work - however, it seems more targeted at more [...]

Comment from layne
Time: July 18, 2007, 9:11 pm

Thank you for making this easier!

One thing I’d like to point out is that I ran into a small problem that is easily fixable. The b2evolution I am working with is version 0.9.0.12.

“author()” isn’t recognized by this version (or at least, the blog I am working with), but if it is replaced with “Author->prefered_name()”, everything works out fine!

Comment from Neil Cowley
Time: July 24, 2007, 4:10 am

Just switched over the entire 3 years of blogging to Workpress using this tool, much faster and no-headaches of Database manipulation! Great workaround!!

Pingback from toddjohnston.org » Blog Archive » Switching Hosts and Blogging tools
Time: August 28, 2007, 8:02 am

[...] to the curb as well. In the process of getting my posts transferred over I came across this guide which made the transition [...]

Comment from Diane
Time: August 28, 2007, 3:53 pm

Well, I wish I could say that it worked seamlessly for me. It imported only partially and as one long comment, no posts. I probably did something wrong. This is my third try to convert my blog and I’m about ready to give up.

Comment from cmb
Time: August 28, 2007, 4:36 pm

Diane, if you send me a copy of the text file you created then I can probably find the problem quickly enough. Not really much anybody can do to help with the information you’ve given us so far!

Comment from Diane
Time: August 28, 2007, 5:07 pm

Hmm, I’ve tried going through the steps again. The thing is that the blog never looks “a bit of a mess”, so I’m wondering if the two files that are supposed to strip the skin are not working correctly, or if I’m doing something wrong. The comments are stripping down, but not the posts.

Comment from Diane
Time: August 28, 2007, 5:18 pm

I posted the archive list I’m getting as my website.

Comment from Manuel
Time: August 29, 2007, 9:56 am

Thanks for that interesting approach. What about the different authors? I have 30 different writers and lots of articles written by them.

I understand that I have to create them in my wordpress from scratch. Should I do this before I use your method? Will the articles be connected to the author?

sorry for my bad english ;-)

Comment from cmb
Time: August 29, 2007, 10:23 am

Manuel: When you import to wordpress it should guide you through creating separate users for each account, I had five or so authors on my old b2evolution blog and they all imported perfectly

Diane: Something has definitely gone wrong there, it looks to me like you copied _feedback.php correctly, but did not update _main.php. When you correctly copy _main.php the page should look like absolute garbage (no graphics at all, no sidebar, just ascii text).

Could you try copying _mainphp.txt over your blog’s _main.php again (be sure that you rename it so it actually overwrites!). To make 100% sure that nothing is interfering, perhaps it would be a good idea to make a new theme containing ONLY my _main.php and _feedback.php files.

Comment from Manuel
Time: August 29, 2007, 10:47 am

Wow - nice. I will try this then… and give a Feedback here ;-)

Once again, thanks for your effort - saving us DBchangeHaters trouble!

Comment from Diane
Time: August 30, 2007, 1:17 pm

Thanks for you help. I changed the skin in the way you said and now I have it all imported. Thanks so much! I’m switching my links to the new blog now. This is terrific!

Comment from manuel
Time: September 11, 2007, 2:40 pm

Great! It worked very well.

Does anyone know, how I can redirect old permalinks like:

index.php?title=this_entry_here&more=1&c=1&tb=1&pb=1

to my new permalinks: /%category%/%postname%

Its not so good, the old links get a:

“1 I really need an ID for this to work.”

and that´s it ;-((

Don´t get me wrong - the urls inside work ok, it´s linkage from outside, I´m talking about.

Comment from cmb
Time: September 13, 2007, 11:25 pm

I don’t think that is easy to achieve, since the category names are not present in the b2evolution urls you can’t do a simple rewrite.

There should, however, be a possible workaround using mod_rewrite to redirect all requests for one of the missing pages with urls like this:

/index.php?title=post_title&more=1&c=1&tb=1&pb=1

To a page like this:

/?s=post_title

which will automatically perform a search on your blog and display the most relevant post. Hopefully in almost all cases this will be the post with the matching title!

Comment from Manuel
Time: September 14, 2007, 9:56 am

Hell, that´s a great idea!

can you write down the code for that, please?

You would make my Day ;-)

And by the way - do you have a donation-button somewhere around? I would like to donate a little bit for your great tutorial.

Cheers,
Manuel

Pingback from Bumsdiekuh » Blog Archive » Umzug von b2evolution nach Wordpress
Time: October 3, 2007, 4:47 pm

[...] 1. Auf der b2evolution Installation einen Skin installieren, der die Posts im Movable Type Format ausgibt. (Den Skin und die Anleitung gibt es hier) [...]

Pingback from The (almost) complete guide to migrate b2evolution to Wordpress : Small Business Entrepreneur blog
Time: October 29, 2007, 10:09 pm

[...] content to “Movable type” and then import it into wordpress. The complete procedures on How to Import b2evolution Posts to Wordpress - worked [...]

Comment from Gren
Time: January 28, 2008, 2:31 am

I wasn’t reading the directions quite right at first and was about to give up but once I wised up and *duh* read everything it worked flawlessly! Thank you for saving 3 years of my hard work and wasted time!!

Comment from mary
Time: March 2, 2008, 7:10 am

This is awesome!! Thank you. I’ve been having a lot of trouble with my b2evolution blog, and after a recent update which was supposed to fix everything, and which took me forever to get working, I finally decided it was time to migrate. I had no idea it would be so easy to do!! Thanks, your directions are flawless and the changeover was a breeze. I was sweating bullets as I deleted my b2evolution install even though I had backups, but my fears were unfounded!!

Thanks again.

Pingback from Blog Changes
Time: March 2, 2008, 7:18 am

[...] Mary’s Pad is now running on Wordpress, migrated successfully from b2evolution, thanks to cmb.  And a big thanks to Kaki for giving me the heads up on my broken [...]

Pingback from sixumbrellas » Blog Archiv » Umzug
Time: March 14, 2008, 4:15 pm

[...] es jemanden interessiert: Um von B2Evolution 0.9 nach Wordpress zu migrieren, empfiehlt sich dieser Ansatz. Nach ein paar Startschwierigkeiten hat das eigentlich ziemlich problemlos [...]

Write a comment