Technosailor.com Readers! Donate today to assist the Lambi Fund Haiti Peasant Relief in their efforts.

22 November 2005 186 Comments

Textpattern to WordPress Import Script

I have not been posting much the past few days because I’ve been busy at work writing a detailed Textpattern importer for WordPress. This import script, should it be included in the core source code, will allow Textpattern bloggers to make the switch to WordPress.

We even have Textile, guys! Come on in, the water is nice!

But we don’t have to wait for the code to be dropped into the source. It is a part of the official WP 2 code now. Simply

# “Download textpattern.php”:http://trac.wordpress.org/file/trunk/wp-admin/import/textpattern.php
# Edit your Textpattern database details
# Rename textpattern.php
# Upload to wp-admin/import (replace existing)
# Login to wp-admin
# Click on Import > Textpattern
# Change Log

Some details provided during the import, but that you should also know before running.

h3. Users

You have already setup WordPress, but you also have users in Textpattern. We have taken care to import all of your users into our system. Unfortunately there is one downside. Because both WordPress and Textpattern uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users. *Every _imported_ user has the same username, but their passwords are reset to password123*.

h3. Preserving Authors

Secondly, we have attempted to preserve post authors. If you are the only author or contributor to your blog, then you are safe. In most cases, we are successful in this preservation endeavor. However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.

h3. Textile

Also, since you’re coming from Textpattern, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing “Textile for WordPress”:http://www.huddledmasses.org/2004/04/19/wordpress-plugin-textile-20/. Trust me… You’ll want it.

Enjoy.


v0.1 (Nov 23, 2005)
* Initial Release

v0.2 (Nov 25, 2005)
* Utilized WP API to insert links, cats, posts, comments and users
* Reinvented some WP API functions to assist in import
* Added link import
* Optimized code (Can anyone figure out how to make post/comment portion run in under 30 seconds”?)
* General aesthetic improvements

v0.3 (Nov 28, 2005)
* Moved $txpdb to after first step to prevent importer page from crashing for non-Textpattern importers

v0.4 (Nov 29, 2005)
* Gettext improvements
* Moved TXP Database Connection settings to user submitted form
* Stored TXP database connection settings in options table
* removed global txp database connection object and replaced with per function connections
* Removed ADDDATE() function from MySQL queries to prevent MySQL version < 4.1 issues

Pick up your copy of the WordPress Bible, a wildly popular resource for beginners and experts alike.

Popularity: 2% [?]

186 Responses to “Textpattern to WordPress Import Script”

  1. Robert Ellis 11 February 2006 at 12:48 pm #

    I tried both importers, yours and the one that came with WordPress, and I get the same error messages with both. I don’t think there were any changes to the database between 4.0.1 and 4.0.3.

    Am I supposed to import my Textpattern tables into the WP database before importing? Seems odd, but I thought I saw a comment regarding that above.

  2. Robert Ellis 11 February 2006 at 12:48 pm #

    I tried both importers, yours and the one that came with WordPress, and I get the same error messages with both. I don’t think there were any changes to the database between 4.0.1 and 4.0.3.

    Am I supposed to import my Textpattern tables into the WP database before importing? Seems odd, but I thought I saw a comment regarding that above.

  3. Robert Ellis 11 February 2006 at 12:48 pm #

    I tried both importers, yours and the one that came with WordPress, and I get the same error messages with both. I don’t think there were any changes to the database between 4.0.1 and 4.0.3.

    Am I supposed to import my Textpattern tables into the WP database before importing? Seems odd, but I thought I saw a comment regarding that above.

  4. Aaron 11 February 2006 at 12:58 pm #

    It helps if they are in the same database, and it helps if they are on the same server, but no you don’t have to import them. The importer does that for you.

    I am presuming you have actually installed WordPress succesfully before attempting to import?

    I also presume your WordPress table prefix is wp_?

  5. Aaron 11 February 2006 at 12:58 pm #

    It helps if they are in the same database, and it helps if they are on the same server, but no you don’t have to import them. The importer does that for you.

    I am presuming you have actually installed WordPress succesfully before attempting to import?

    I also presume your WordPress table prefix is wp_?

  6. Aaron 11 February 2006 at 12:58 pm #

    It helps if they are in the same database, and it helps if they are on the same server, but no you don’t have to import them. The importer does that for you.

    I am presuming you have actually installed WordPress succesfully before attempting to import?

    I also presume your WordPress table prefix is wp_?

  7. Robert Ellis 11 February 2006 at 1:39 pm #

    Yes, WP was successfully installed and the table prefix is wp_. I moved the Textpattern tables into the WP database (they were in separate databases on the same server) and the import seems to be working now (I have a few hundred entries so it’s taking a long time). Things seem to be okay so far. Thanks very much!

  8. Robert Ellis 11 February 2006 at 1:39 pm #

    Yes, WP was successfully installed and the table prefix is wp_. I moved the Textpattern tables into the WP database (they were in separate databases on the same server) and the import seems to be working now (I have a few hundred entries so it’s taking a long time). Things seem to be okay so far. Thanks very much!

  9. Robert Ellis 11 February 2006 at 1:39 pm #

    Yes, WP was successfully installed and the table prefix is wp_. I moved the Textpattern tables into the WP database (they were in separate databases on the same server) and the import seems to be working now (I have a few hundred entries so it’s taking a long time). Things seem to be okay so far. Thanks very much!

  10. Aaron 11 February 2006 at 1:43 pm #

    Cool!

    The only thing I can think of is that the first page of the importer prompts you for your Textpattern database info and you might have thought it wanted your WP info.

  11. Aaron 11 February 2006 at 1:43 pm #

    Cool!

    The only thing I can think of is that the first page of the importer prompts you for your Textpattern database info and you might have thought it wanted your WP info.

  12. Aaron 11 February 2006 at 1:43 pm #

    Cool!

    The only thing I can think of is that the first page of the importer prompts you for your Textpattern database info and you might have thought it wanted your WP info.

  13. Robert Ellis 11 February 2006 at 4:09 pm #

    Nope, I entered the info for the Textpattern database. It was only after moving the tables into the WP database and specifying the WP database that it worked. But I think I’ve got it now. Thanks again!

  14. Robert Ellis 11 February 2006 at 4:09 pm #

    Nope, I entered the info for the Textpattern database. It was only after moving the tables into the WP database and specifying the WP database that it worked. But I think I’ve got it now. Thanks again!

  15. Robert Ellis 11 February 2006 at 4:09 pm #

    Nope, I entered the info for the Textpattern database. It was only after moving the tables into the WP database and specifying the WP database that it worked. But I think I’ve got it now. Thanks again!

  16. Andrei Maxim 18 February 2006 at 8:27 am #

    Hi,

    It seems that there are some issues with UTF-8 characters, like ă, î, ş, ţ and â.

    What needs to be changed so I can see the proper characters instead of “?”?

  17. Andrei Maxim 18 February 2006 at 8:27 am #

    Hi,

    It seems that there are some issues with UTF-8 characters, like ă, î, ş, ţ and â.

    What needs to be changed so I can see the proper characters instead of “?”?

  18. Andrei Maxim 18 February 2006 at 8:27 am #

    Hi,

    It seems that there are some issues with UTF-8 characters, like ă, î, ş, ţ and â.

    What needs to be changed so I can see the proper characters instead of “?”?

  19. Jack 1 April 2006 at 11:38 am #

    For the record, I also had to add my existing textpattern tables into the target wordpress database before the import worked. Specifying a separate Textpattern database failed with the same error as above. (Textpattern 4.0.2 to WP 2.0.2)

  20. Jack 1 April 2006 at 11:38 am #

    For the record, I also had to add my existing textpattern tables into the target wordpress database before the import worked. Specifying a separate Textpattern database failed with the same error as above. (Textpattern 4.0.2 to WP 2.0.2)

  21. Jack 1 April 2006 at 11:38 am #

    For the record, I also had to add my existing textpattern tables into the target wordpress database before the import worked. Specifying a separate Textpattern database failed with the same error as above. (Textpattern 4.0.2 to WP 2.0.2)

  22. brendon 20 April 2006 at 7:57 pm #

    I have another example of what Jack and Robert are reporting- my TXP install is 4.03, and I downloaded the newest Wordpress… I have the DB’s on the same server, same install of mysql, but the import shows errors like this:

    WordPress database error: [Table 'textpattern.wp_bb_1_categories' doesn't exist]
    SELECT cat_ID FROM wp_bb_1_categories WHERE category_nicename = ‘misc’

    WordPress database error: [Table 'textpattern.wp_bb_1_categories' doesn't exist]
    SELECT cat_ID FROM wp_bb_1_categories WHERE category_nicename = ‘food-dining’

    Wherein “textpattern” IS the db name I entered on the previous page for my textpattern, and wp_bb_1 is the proper table prefix for this WP install.

    Does this mean the first step of your script is to create WP-style tables in my TXP db and map over the data, THEN export it to the WP database? Or is it somehow writing to the wrong one? Or do am I completely lost and should stop while I’m behind? :)

    ANyway- I’m going to try the “import tables into WP database” method for now and see how that works…

    Thanks…

  23. brendon 20 April 2006 at 8:04 pm #

    …Which is to say- after importing the tables into the WP db, and pointing the script to that, it worked like a charm.

  24. brendon 20 April 2006 at 7:57 pm #

    I have another example of what Jack and Robert are reporting- my TXP install is 4.03, and I downloaded the newest Wordpress… I have the DB’s on the same server, same install of mysql, but the import shows errors like this:

    WordPress database error: [Table 'textpattern.wp_bb_1_categories' doesn't exist]
    SELECT cat_ID FROM wp_bb_1_categories WHERE category_nicename = ‘misc’

    WordPress database error: [Table 'textpattern.wp_bb_1_categories' doesn't exist]
    SELECT cat_ID FROM wp_bb_1_categories WHERE category_nicename = ‘food-dining’

    Wherein “textpattern” IS the db name I entered on the previous page for my textpattern, and wp_bb_1 is the proper table prefix for this WP install.

    Does this mean the first step of your script is to create WP-style tables in my TXP db and map over the data, THEN export it to the WP database? Or is it somehow writing to the wrong one? Or do am I completely lost and should stop while I’m behind? :)

    ANyway- I’m going to try the “import tables into WP database” method for now and see how that works…

    Thanks…

  25. brendon 20 April 2006 at 7:57 pm #

    I have another example of what Jack and Robert are reporting- my TXP install is 4.03, and I downloaded the newest Wordpress… I have the DB’s on the same server, same install of mysql, but the import shows errors like this:

    WordPress database error: [Table 'textpattern.wp_bb_1_categories' doesn't exist]
    SELECT cat_ID FROM wp_bb_1_categories WHERE category_nicename = ‘misc’

    WordPress database error: [Table 'textpattern.wp_bb_1_categories' doesn't exist]
    SELECT cat_ID FROM wp_bb_1_categories WHERE category_nicename = ‘food-dining’

    Wherein “textpattern” IS the db name I entered on the previous page for my textpattern, and wp_bb_1 is the proper table prefix for this WP install.

    Does this mean the first step of your script is to create WP-style tables in my TXP db and map over the data, THEN export it to the WP database? Or is it somehow writing to the wrong one? Or do am I completely lost and should stop while I’m behind? :)

    ANyway- I’m going to try the “import tables into WP database” method for now and see how that works…

    Thanks…

  26. brendon 20 April 2006 at 8:04 pm #

    …Which is to say- after importing the tables into the WP db, and pointing the script to that, it worked like a charm.

  27. brendon 20 April 2006 at 8:04 pm #

    …Which is to say- after importing the tables into the WP db, and pointing the script to that, it worked like a charm.

  28. a. 22 April 2006 at 10:11 pm #

    Hi! I’m hoping you can help me. I tried the import feature and get the following errors (among others…)

    When attempting to import textpattern posts to wordpress I get the following error:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/txp_category WHERE type = "article"' at line 5]
    SELECT id, name, title FROM /txp_category WHERE type = “article”
    No Categories to Import!

    Can you point me in the right direction to correct this? I don’t know anything about importing tables,etc. Any help is appreciated. Thanks.

  29. a. 22 April 2006 at 10:11 pm #

    Hi! I’m hoping you can help me. I tried the import feature and get the following errors (among others…)

    When attempting to import textpattern posts to wordpress I get the following error:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/txp_category WHERE type = "article"' at line 5]
    SELECT id, name, title FROM /txp_category WHERE type = “article”
    No Categories to Import!

    Can you point me in the right direction to correct this? I don’t know anything about importing tables,etc. Any help is appreciated. Thanks.

  30. a. 22 April 2006 at 10:11 pm #

    Hi! I’m hoping you can help me. I tried the import feature and get the following errors (among others…)

    When attempting to import textpattern posts to wordpress I get the following error:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/txp_category WHERE type = "article"' at line 5]
    SELECT id, name, title FROM /txp_category WHERE type = “article”
    No Categories to Import!

    Can you point me in the right direction to correct this? I don’t know anything about importing tables,etc. Any help is appreciated. Thanks.

  31. a. 23 April 2006 at 5:07 am #

    I moved wordpress to the textpattern database and the import went smoothly. Thanks!

  32. a. 23 April 2006 at 5:07 am #

    I moved wordpress to the textpattern database and the import went smoothly. Thanks!

  33. a. 23 April 2006 at 5:07 am #

    I moved wordpress to the textpattern database and the import went smoothly. Thanks!

  34. R Salama 20 January 2007 at 10:51 am #

    Hello,

    I’ve done the import without any drama. And I’ve installed the textile for wordpress plugin, again without any drama.

    However, I use the following to produce a thumbnailed image that can be clicked to produce a full sized image in a new window:

    Now, this doesn’t work after import, and it’s a bit of showstopper. Any help?

  35. R Salama 20 January 2007 at 9:51 am #

    Hello,

    I’ve done the import without any drama. And I’ve installed the textile for wordpress plugin, again without any drama.

    However, I use the following to produce a thumbnailed image that can be clicked to produce a full sized image in a new window:

    Now, this doesn’t work after import, and it’s a bit of showstopper. Any help?

  36. R Salama 20 January 2007 at 9:51 am #

    Hello,

    I’ve done the import without any drama. And I’ve installed the textile for wordpress plugin, again without any drama.

    However, I use the following to produce a thumbnailed image that can be clicked to produce a full sized image in a new window:

    Now, this doesn’t work after import, and it’s a bit of showstopper. Any help?