Does anyone have any pointers on migrating a WordPress blog w/ comments to Drupal?

Drupal seems to be the most scalable system, and I would love to start using it.

Any thoughts?

Comments

NuclearMoose’s picture

Have you checked WordPress support forum for any help in this regard? I have to say that WP support has me spoiled. I'm rather disappointed by the forum support here.

Bèr Kessels’s picture

Well, if you are not happy with it: don't complain but do something about it.
I find this comment of yours rather ungratefull. Just look for a single moment at the amount of good information that is available on drupal.org in the form of forums, mailinglist archives, handbook(s) issue and support trackers etcetc! Many people, spend a lot of their free time writing, structuring, filtering and adding that information, Or support, if you wish. So I think it is hurts those spending that time if they hear from someone who has written 2 (!) posts, that the support is bad. How can you say that, after having asked one question, that might not been answered directly? (the reason why it was not answered, is probably because that question is handled in installation handbook and the FAQ).

Regards,
[Ber | Drupal Services webschuur.com]

Kobus’s picture

Ber,

I agree with you on this one. I, for one, have asked many questions here, some got answered some not. Those that were not answered had me thinking whether it was a stupid question or whether it was relevant. Many of those questions that weren't answered I eventually found already answered in the forum, mailing lists or handbook.

To all the Drupal folks out there who work on the documentation and support (and also the developers), you're doing a great job! [*raises glass*], CHEERS!

-- Kobus

cel4145’s picture

I'm not a developer. But as a user who frequently tries to provide suggestions and support on drupal.org and create documentation, I would echo Ber's note about contributing rather than merely critiquing.

Meanwhile, I think it highly unlikely that WP support is going to provide information on migrating from WP to Drupal.

shi’s picture

you are correct :) how will wordpress offer such a kind of support

mgorsuch’s picture

hmm... if I can figure out how to convert the WordPress timestamp to Drupal's version, I can probably write a perl script to handle the import db-to-db.

We shall see...

mgorsuch’s picture

I have just run a test export from WP and Import into drupal via a PHP script I wrote.

At the moment I've got the posts and the comments to come across.

I will post the code shortly!

kmartino’s picture

I am very interested in this code. Can you post it here? I need to migrate a set of posts from WordPress to Drupal ASAP. Thanks in advance!

crw’s picture

Here's the code I used:

$wp_date = "2004-11-14 01:29:50"; // just an example
$temp_date = str_replace(" ",":",$wp_date);
list($year,$month,$day,$hour,$minute,$second) = split('[-:]',$temp_date);
$epoch_date = mktime($hour,$minute,$second,$month,$day,$year);

You can probably remove the str_replace statement and add the space to the split(), but I... didn't. :)

I'll be posting a wp2drupal script soonish.

Gábor Hojtsy’s picture

It is much easier to use http://www.php.net/strtotime, and it is a lot less code too :)

TerranceDC’s picture

Whatever happened with the WordPress to Drupal script? In the end, went with WordPress when I moved my blog off Typepad, because there wasn't a simple way to move all my conent into Drupal. Is there a relatively simple way to make the move from WordPress?

killes@www.drop.org’s picture

http://ninjafish.org/project/wp2drupal

--
If you have troubles with a particular contrib project, please consider to file a support request. Thanks.

clbustos’s picture

Hi folks. I have to move a site from WP to Drupal and I did a little script on php that export the users, comments, post and categories. Please, take a look and tell me how works for you.

http://apsique.virtuabyte.cl/php/system/files?file=wp_goto_dr.tgz: Wordpress go to Drupal.

djbayer@drupal.org’s picture

My database move from a simple Wordpress site to drupal using your script went great. Little things at first went wrong (not placing the script in the root where adodb was located, not inserting an underscore after the database wp prefix in the script itself), but the error messages made it easy for me to correct the problems. Basically, all post text, comments, usernames, and in-text pictures were transferred as is. Some things I need to adjust, like the locations of some javascript files called for in certain posts, and I need to figure out how I'm going to be able to utilize some Wordpress plugins, particularly flickr gallery, from drupal; but basically, Many Thanks for your work. I think drupal is the place for me to be at this point in the evolution of my use of the Internet in my teaching, and I am very grateful to all of you who help us non-programmer users.

clbustos’s picture

I'm very glad that the script was useful to you and some other guys.
I make a little update, with some extra comments, the 'wp_' stuff and other minor fixes.
Download at
http://apsique.virtuabyte.cl/php/system/files?file=wp_goto_dr_0_0_2.tar.gz

phatPhrog’s picture

I take it this code has been removed because it doesn't work for a translation to 4.6.0 RC?

Is there another database conversion tool available anywhere yet?

I know, I know....I'm pushing the envelope a bit.

clbustos’s picture

I changed a bit the config of the site, so the new URL is
">http://php.apsique.com/files/wp_goto_dr_0_0_2.tar.gz

I don't know if will work with drupal 4.6. Probably, no

And traslate the categories to one vocabulary. Nice to merge multiple blogs on one drupal site.

phatPhrog’s picture

I get this when clicking on the link

Página no encontrada

oops :)~

clbustos’s picture

Yep, a 404 error.
The new and definitive URL is
http://php.apsique.com/project/wp_goto_dr
That is!

matthew’s picture

I'm in the middle of converting my Wordpress 1.5 blog over to Drupal 4.6. It's very slow going. I was wondering if you'd be so kind as to update your script to import for 4.6?

Best,

Matthew

budda’s picture

I've not used the script myself, but am interested in knowing wether the WordPress categories transfered over okay too?

--
www.bargainspy.co.uk | www.spamfo.co.uk | www.buddasworld.co.uk

clbustos’s picture

Yes. The users, posts, categories and comments will be imported. You can create an .htaccess file from WP "clean" URLs to Drupals ones, too!

rianjs’s picture

Does the script work for importing from WP 1.5?

clbustos’s picture

I'm only working on drupal, rigth now... Someone test it on WP 1.5?

clbustos’s picture

Sam Revitch update my script for Drupal 4.6 and Wordpress 1.5. I don't test it yet, but you can give your opinions :)
http://lsb.blogdns.net/pages/wordpress-migration-utility

chanzero’s picture

this script sounds great! however when i runt it i get an error saying “Failed opening ‘../adodb/adodb.inc.php’ for inclusion”

but when i look in the adodb folder, i do not see such a file — they all have names like “adodb-” (“adodob-lib.inc.php”, “adodob-php4.inc.php”, etc), no "adodb.inc.php" :(

thanks in advance

chrishaslam’s picture

Many thanks for the script at http://lsb.blogdns.net/pages/wordpress-migration-utility - I had success using this script.

It took across all my wordpress categories to drupal plus all the posts (now stories) and best of all it worked perfectly with autopath ensuring my URLs all stay the same.

One point I would like to mention here is that regarding spam comments. Previously in wordpress I marked suspect comments as spam rather than to delete them - now these comments did come across to drupal and were in a published state.

So - if you are moving from a wordpress blog that had comments marked as spam make sure you look over them afterwards as the usual viagra and poker spam rubbish could have come across with your migration.

[edit] - I went from wordpress 1.5 to drupal 4.6.3

--------------------------------------------------------
"I spent a lot of my money on booze, birds, and fast cars. The rest I just squandered." --- George Best

---------------------------
Managed Drupal hosting from Ixis IT

pamphile’s picture

I"m also interested in the Workpress 2 Drupal script

Junyor’s picture

Maybe these conversion scripts could make their way onto Drupal.org so others can work on maintaining them?

reikiman’s picture

I've used the conversion tool downloaded from here: http://lsb.blogdns.net/pages/wordpress-migration-utility

I have wordpress 1.5.1 (http://7gen.com/) and a freshly installed drupal 4.6.1 (http://7gen.com/drupal/)

The conversion went pretty well. However there's one funny thing about it.

The titles for each posting ought to be a link to a page that shows just the posting, yes? Well, instead, it's a link that goes to a mangled URL that's derived from the wordpress URL's.

To be clear about what I mean:

WP URL: http://7gen.com/index.php/2005/06/22/re-a-possible-road-ahead/
Drupal URL: http://7gen.com/drupal/index.php/2005/06/22/re-a-possible-road-ahead

Any ideas? I tried looking at the database tables and didn't see anything there which controlled this.

Another issue is that links inside articles didn't get converted. Some of my wordpress blog entries referred to other of my wordpress blog entries, and when the articles were converted to Drupal those links weren't converted.

Oh, and the last thing I'm noticing is that the nodes, when imported, were imported as "Story" nodes -- rather than "blog" nodes.

David Herron - http://7gen.com/

reikiman’s picture

Oh, and, I noticed that visiting http//7gen.com/drupal/node/nnn gives me the expected article display.

David Herron - http://7gen.com/

reikiman’s picture

I figured out what was off in the database.

First, the node types (table "node" field "type") were all "story", and changing them to "blog" got them listed properly in the blog section.

e.g.: update node set type = "blog" where type = "story";

Second, the url_alias table has entries for every one of the nodes. I don't see in the administrator section a way to configure aliases. So I did this: delete from url_alias;

David Herron - http://7gen.com/

Geary’s picture

I'm converting my WordPress blog to Drupal right now, and I noticed the same thing about the blog vs. story. So I changed the script to make blog entries instead of stories.

After looking at the result, I think I'll switch it back to story. Drupal's blog module makes sense for a multiuser blog, where you want to aggregate everyone's blogs onto the front page but still provide a separate blog page for each person. But for a single-user blog like a typical WordPress blog, the story module seems to fit better.

With the blog module, each post has a link at the bottom saying "Michael Geary's blog", and that link goes to my personal blog page. But that's useless, since the front page is *already* my personal blog page.

The story module gives me a front page just like a traditional WordPress blog without the duplication.

LoveBeingADad’s picture

I have a Wordpress 1.2.1 site that I need to convert to Drupal 4.6.2.
I ran the script found at: http://lsb.blogdns.net/pages/wordpress-migration-utility and it almost worked. It seems to get the users right, the categories come in beautifully, but it only brings in two blog entries and lists some errors.

I thought it might be because my site is WP v1.2.1 rather than WP v1.5.1. So I updated my Wordpress site to v1.5.1.3 and then ran the migration tool again and got the same errors.

Here is the output I get. I'm hoping someone out there can give me some clues as to where to go:

Conect?ndose a WP por contenidos 

(mysql): SELECT id, user_login,user_pass,user_email,user_url,user_level FROM freeblog_users   

(mysql): SELECT ID,post_date,post_title,post_category, post_content,post_excerpt,post_name,post_author,post_status,comment_status FROM freeblog_posts ORDER BY post_date   

(mysql): SELECT cat_id,cat_name,category_nicename,category_description,category_parent from freeblog_categories   

(mysql): SELECT post_id,category_id FROM freeblog_post2cat   

(mysql): SELECT * from freeblog_comments  
Notice: Undefined variable: nNodeTeaserLength in /Library/WebServer/Documents/mysite/engine.php on line 340

Notice: Undefined offset: 2 in /Library/WebServer/Documents/mysite/engine.php on line 269

Notice: Undefined variable: nNodeTeaserLength in /Library/WebServer/Documents/mysite/engine.php on line 340
Duplicate entry '' for key 2
sire’s picture

This is an error I'm getting too, converting from WP 1.5.1.3 to Drupal 4.6.2

(mysql): SELECT * from wp_comments
Duplicate entry '' for key 2

UPDATING:

I edited adodb/adodb.inc.php function &Execute() to show me all the sql statements as they are executed. The statement right before it fails might be in reference to table url_alias.

INSERT INTO url_alias (pid,src,dst) VALUES (NULL,?,?)
Duplicate entry '' for key 2

Key 2 is ' dst ' field in url_alias table.

Further testing, if I set a value to ' false ' it proceeds without visible error.

$bPermalinkAlias = false; // create path module aliases for permalinks

LoveBeingADad’s picture

Thanks for your sleuthing and more importantly for reporting it! That is just what I needed to get it to work. Woohoo, now off to futzing with everything else!

ashwink’s picture

thanks a lot. the script works great. :)

"no quotes within quotes"

rcdiugun’s picture

I was finally able to make my script run. It didn't want to run on my local host but it worked perfectly on the target host. :)

Some points to note:

I was able to use the same script thrice, porting three wp databases into one drupal database. (I wanted my three blogs to be accessed on just one drupal site.) It worked great! When doing this, (in wp_migrate.php) the first time you run it, set $bDeleteAll = true to delete existing entries in the target Drupal database. Set it to false for the succeeding databases after that. You might want to set $bPermalinkAlias = false as well if you have trouble importing the permalinks.

I was able to successfully import my wp databases to a drupal database that has prefixes on the tables. Just give me time to clean up my code and repackage it and recreate a more understandable documentation on how to use the script. :)

One last thing, for those who are using this script -- If you find yourself not able to post new items in drupal after using this script, update the entries in the SEQUENCES table. :)

Good luck everybody!

jdavidow’s picture

I have tried your script, and I still get only the two blog entries migrated.

I tried to add the line '$bPermalinkAlias = false;' to the top of the engine.php script, but I get the same result.

Can you help me out? Thanks!

microx’s picture

You don't add $bPermalinkAlias = false; to the engine.php script, you change $bPermalinkAlias = true; to $bPermalinkAlias = false; in the wp_migrate.php script.

Hope that helps!

-----
Rotoclone.com
The Rotoclone Forum

trip’s picture

Here is the error(s):

Warning: fputs(): supplied argument is not a valid stream resource in /home/musingmo/www/www/engine.php on line 22

Warning: mysql_connect(): Access denied for user: 'musingmo@localhost' (Using password: NO) in /home/musingmo/www/www/adodb/drivers/adodb-mysql.inc.php on line 354

Fatal error: Call to a member function on a non-object in /home/musingmo/www/www/engine.php on line 478

Line 22 has to do with Rewrite. Host has rewrite on for htaccess files.

I entered the user and password in the config file so I am not sure about the second error.

I do not even know where to start on the third error.

Any ideas would be supremely appreciated.

trip’s picture

You need to run the wp_migrate.php script, not the engine.php script.

Worked like a charm. Thanks!

hpn’s picture

Yep, worked for me too. See the results:
http://hpnadig.net/blog/

The only problem I faced was of spam getting listed as comments on conversion (Delete all the comments from wp database wp-comments table that has "spam" in field 'type' before doing the conversion)

If you're trying to convert from Wordpress 2.0 to drupal, you'll need to make few changes in the engine.php (few minor ones), since the database structure for wp 2 has changed a bit (They’ve now moved “userlevel” field to a new table called “usermeta”).

--
http://hpnadig.net/blog/

tarek’s picture

I've been playing around and trying to figure out how to make these 'few minor changes', but haven't been able to.. help?

tarek : )

hpn’s picture

>> They’ve now moved “userlevel” field to a new table called “usermeta”

you'll have to modify the script pertaining to this above difference.

--
http://hpnadig.net/blog/

drmike’s picture

I had the same issue as well and I was running the wp_migrate.php file. :)

The issue is that the script is looking for the htaccess_wp file to save rewrites to. Create this file in the wp_migrate subdirectory and give it a 777 Permission. Run the script and add the output to Drupal's own htaccess file. That's how Drupal gets the rewrites.

Hope this helps,
-drmike

euchrid9’s picture

I strongly suggest to anyone converting from Wordpress to Drupal using the excellent wp_migrate, as I just did, to have a good think about whether you want to keep the current look of your site or change to a new one. The reason being: it is not always easy to keep the look or the structure.

I had four blogs that I wanted to combine into one. I needed to keep the blogs separate, but have the ability to group them all together. I tried using the Flexinode module to keep each blog separate and then style the nodes as discussed elsewhere in drupal.org (I can't find the articles again just now).

When moving from Wordpress, it is far easier to follow the instructions for creating a new node than it is to move your blogs and pages into new node types and theme them using Flexinode.

Next, you just theme the node you created. Doing this allows you to maintain control over different parts of your site, keep old Wordpress blogs separate but controllable together, and means you can import your Wordpress blogs without trouble.

I appreciate this is not helpful for everyone, but anyone who has spent hours scouring these forums for help in importing multiple Wordpress blogs into Drupal and themeing them will appreciate it!

I found that it was possible, using wp_migrate, to import multiple blogs into my newly defined nodes quite easily, but it took me many hours of research, trying to understand Drupal terminology and methods. Don't give up! It's confusing as Hell, but well worth the effort in the end. Once you get what's going on here, it gets easier.

I know very little about php code, am no expert with html and css, but I got it all working in the end. When coming from Wordpress to Drupal, one of the most confusing things is 'categories'; Wordpress called them categories; Drupal refers to them as vocabulary, terms, categories and taxonomies - but, from a Wordpress point of view, they all mean pretty much the same thing.

Hope this all helps!

E-mail me if you get stuck with what I put here - I'll try and explain it better.

[euchrid]
www.euchrid.co.uk

Mr_Cynical’s picture

Does anyone know if either of these (wp_goto_dr or Wordpress Migration Utility) can convert permalinks? I want to convert from Wordpress to Drupal for ethical reasons, but I don't want to lose existing search engine ranking and links, so I need a lot of redirects. But since I have approaching 400 posts I do not want to have to write them myself. I can get the first half of the code:RedirectPermanent [Wordpress_permalink] generated with a quick PHP script, but it would be helpful if I could get a script to give me the Drupal permalinks (before I install Drupal) for writing these codes - or, even better, write the entire thing for me. Is this possible or should I dig out my typing fingers?

hpn’s picture

You'll need to use the pathauto module and replicate the older path in the pathauto config (admin/settings/pathauto).

All the posts can be made to retain the permalink URLs (I did the same for my blog).
--
http://hpnadig.net/blog/

Mr_Cynical’s picture

I am reasonably comfortable using phpmyadmin (well, comfortable as in copy-pasting prewritten SQL statements into it) - is it possible to use an SQL query to convert the Wordpress posts and comments into the format required for dumping into the Drupal database?

(PS: Sorry about the double post, I thought this could use a bump)

Mr_Cynical’s picture

When I run the WP Migration Utility script, I get errors saying it couldn't access the database even though I KNOW the login information is correct (I copy-pasted it from my wp-config.php). Does anyone know an alternative script?

kgp22’s picture

Since I can't figure out which code to change from Sam's script, I decided to just DOWNGRADE TO 1.5

www.somethingunpredictable.com

http://somethingunpredictable.com/
offers a script that would downgrade Wordpress 2.0 to 1.5.

Then I used Sam's script as instructed. WORKED WELL for me.

drmike’s picture

OK, I did the migrate over from WordPress. Not sure which I'm going to use yet but I'm having clients ask about Drupal so I better get up to speed. :)

I imported all of my posts over from WordPress and they all showed up as Node posts. (If I understand how the terms are over here) I just set up the forum as well and made a post to that but it showed up as a Node post as well. That bothers me as I would rather keep the forum seperate from my posts. Any suggestions or is this the way things are suppose to work?

Also any suggestiosn on moving over the large number of links I have on my site?

Thanks,
-drmike

ronsens’s picture

Please don't blame me for lazyness, but maybe someone has updated the importing script for drupal 4.7?

rickvug’s picture

I'm sure that the script will get updated eventually. For now, the path seems to be creating an install (or at least database) of 4.6 and migrating the info that way. From there, your an upgrade away from using 4.7.

Hope this helps. I'm in the same boat, my thread on this is here.

Rick

-------------------------------------------------------------------
Rick Vugteveen |rickvug.com @rickvug on Twitter

Borek-1’s picture

Hi ronsens, there is a new wp2drupal migration module, see http://drupal.org/node/69706 for more info.

Regards,
Borek, http://borber.com/

parajeff’s picture

Anyone have a solution that works on WP2 and Drupal 4.7 that actually works and doesn't rely on PHP5?

amroz’s picture

What was your experience with Google indexing after the move to Drupal? More than likely your WordPress site was well indexed by Google prior to you moving to Drupal.

Did your page rank change? How long to reestablish your site with Google after the move?

If anyone has any info at all, please respond. I appreciate it.

paoloteo’s picture

Hi to everybody.
just to let you know that a made some litte modifications to Borek's module to make it Drupal 5.x compatible.
You can download it at: http://wp2drupal.teodorani.com/

This project has been sponsored by yapaka.be .

I'm working even on other migration projects that I will post later on.

Bye
Paolo

peoriap’s picture

Thanks for the module!

I'm going to be trying to convert my WP installation.

I got the following message atop the installation screen

warning: fclose(): supplied argument is not a valid stream resource in /home//public_html/drupal/modules/wp2drupal/wp2drupal.module on line 213.

As I am not a php code maven, any idea how to fix this?

Thanks in advance for any help.

btw: Here is my WP site: http://peoriapundit.com/blogpeoria

evrix’s picture

i had the same error, resolved by
chmod -R o+w wp2drupal/

world is made out of facts, not things

L. W.