• Technosailor.com
  • Desk of the Editor
  • Entrepreneurship
  • Web Marketing
  • Tech Policy
  • Contenido EspaƱol
Technosailor
  • Authors
  • Twitter Pitch Me!
  • Disclosures
Nov
22
2005

Textpattern to WordPress Import Script

Posted by: Aaron Brazell

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

  • Add to Mixx!
  • Stumble it!
About the Author: Aaron Brazell is the lead editor of Technosailor.com and a social media expert. His passion is to see companies and individuals use the internet and web technologies wisely and effectively to promote their brands and companies. He is Business Development Manager for Lijit and he worked as Director of Technology at b5media from 2005-2008 and is currently an independent consultant.
Tagged: import_script, php, Programming, textpattern, WordPress at 11:57 pm -
discussion by DISQUS

Add New Comment

  • Subscribe:  This Thread
  • Go to:  My Comments ·  Community Page
  • Sort thread by:

    Viewing 62 Comments

    Thanks. Your comment is awaiting approval by a moderator.

    Do you already have an account? Log in and claim this comment.

      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Pac 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Hi,

      I am completely new to WP and just do not find where in admin panel is the "import" function....

      thanks
      Pascal
      reply  edit  flag   record video comment
      /people/0d2c489eaadb17e6d71381c7d24b011b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      What version of WordPress are you using?
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Pac 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      1.5.2 the latest stable one...
      reply  edit  flag   record video comment
      /people/0d2c489eaadb17e6d71381c7d24b011b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      The importer works only with 2.0 which is forthcoming. It's in beta as we speak. "Use at your own risk":http://wordpress.org/download/nightly-builds/wordpress-2.0-beta-1.zip
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Pac 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Oh, ok... is it a version for previous release? does the one included in 1.5.2 works well?
      reply  edit  flag   record video comment
      /people/0d2c489eaadb17e6d71381c7d24b011b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      There is no version for previous release and I don't have any intention of releasing one. 1.5.x will soon not be the standard.
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Pac 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Ok I have installed the WP 2.0 RC1 and use the embedded script to import from Txp... I have the following error when I try to import posts :
      WordPress database error: [You have an error in your SQL syntax near '"INTERVAL 1 HOURS") AS post_date_gmt, ADDDATE(LastMod, "INTERVAL 1 HOU' at line 15]
      SELECT ID, Posted, AuthorID, LastMod, Title, Body, Excerpt, Category1, Category2, Status, Keywords, url_title, comments_count, ADDDATE(Posted, "INTERVAL 1 HOURS") AS post_date_gmt, ADDDATE(LastMod, "INTERVAL 1 HOURS") AS post_modified_gmt FROM txp_textpattern

      any idea?
      reply  edit  flag   record video comment
      /people/0d2c489eaadb17e6d71381c7d24b011b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      yeah, MySQL version difference. Delete those two ADDDATE lines at the end of that query.
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Pac 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      mmm, now have this error again for posts import :
      "WordPress database error: [You have an error in your SQL syntax near 'FROM txp_textpattern ' at line 15]
      SELECT ID, Posted, AuthorID, LastMod, Title, Body, Excerpt, Category1, Category2, Status, Keywords, url_title, comments_count, FROM txp_textpattern"
      reply  edit  flag   record video comment
      /people/0d2c489eaadb17e6d71381c7d24b011b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Can you post that line between code tags here so I can see whats up?
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Pac 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      mmm, now have this error again for posts import :
      WordPress database error: [You have an error in your SQL syntax near 'FROM txp_textpattern ' at line 15]
      SELECT ID, Posted, AuthorID, LastMod, Title, Body, Excerpt, Category1, Category2, Status, Keywords, url_title, comments_count, FROM txp_textpattern"
      reply  edit  flag   record video comment
      /people/0d2c489eaadb17e6d71381c7d24b011b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Pac 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      [code]WordPress database error: [You have an error in your SQL syntax near 'FROM txp_textpattern ' at line 15]
      SELECT ID, Posted, AuthorID, LastMod, Title, Body, Excerpt, Category1, Category2, Status, Keywords, url_title, comments_count, FROM txp_textpattern[/code]
      reply  edit  flag   record video comment
      /people/0d2c489eaadb17e6d71381c7d24b011b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Pac 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      give-me your tags...
      reply  edit  flag   record video comment
      /people/0d2c489eaadb17e6d71381c7d24b011b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      standard HTML code tags, man. And I need the code, not the error.
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Pac 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      ???? the code is just the one included in WP 2.0 RC1...supposed to be your code!?
      reply  edit  flag   record video comment
      /people/0d2c489eaadb17e6d71381c7d24b011b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Pac 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Just to mention that I tried an import from Txp 4.0.1 ... if it helps...
      reply  edit  flag   record video comment
      /people/0d2c489eaadb17e6d71381c7d24b011b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      It is my code and I told you to remove the two ADDDATE lines from the code, then you reported you were still getting an error.

      So IF you followed my instructions and by doing so you still are getting an error, then I want to see the modified code.
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Pac 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Ok, now it is clear to me... Here is the code where I remove the 2 lines:
      return $txpdb-&gt;get_results('SELECT
      ID,
      Posted,
      AuthorID,
      LastMod,
      Title,
      Body,
      Excerpt,
      Category1,
      Category2,
      Status,
      Keywords,
      url_title,
      comments_count,
      FROM '.$prefix.'textpattern
      ', ARRAY_A);
      reply  edit  flag   record video comment
      /people/0d2c489eaadb17e6d71381c7d24b011b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      And that is still erroring?
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Pac 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      yes! here it is :


      WordPress database error: [You have an error in your SQL syntax near 'FROM txp_textpattern ' at line 15]
      SELECT ID, Posted, AuthorID, LastMod, Title, Body, Excerpt, Category1, Category2, Status, Keywords, url_title, comments_count, FROM txp_textpattern

      Done! 0 posts imported.
      reply  edit  flag   record video comment
      /people/0d2c489eaadb17e6d71381c7d24b011b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Why don't you grab the newly modified code from the "WordPress source":http://trac.wordpress.org/file/trunk/wp-admin/import/textpattern.php
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v