Textpattern To WordPress Migration And Importer Updates

After many years on the Textpattern blogging platform, I’ve migrated Place Name Here over to WordPress. Though it only took a day or two to migrate blog posts and comments dating back to 2004 and create a theme to match, it was a move that needed some massaging.

Why Change?

I had been contemplating the change for some time now. I’ve used both systems, as well as others like Movable Type, for personal and client projects and have a good feel for each system’s strengths. I was seeing that where WP was headed is more aligned with where I think I want to take this site. It isn’t that there was anything wrong with Textpattern—in fact in many ways I still prefer it’s simplicity, template system and other core features. But that project seemed to have plateaud and contributions, updates and roadmaps are sometimes unclear. WordPress has continued to move forward and make easier some of the features I’ve been wanting to add (pingbacks, gravatars, other blogging and infrastructure fluff). But since these weren’t pressing needs, I just kept bumping the move until recently when I had the time to look at it again.

Data Importer Hiccups & Changes

Having a relatively simple markup structure to begin with for the old site’s templates made the theme transition relatively easy. By creating a child theme of Twenty Ten and editing just 9 of the files (along with a bit of experience) got me to what you see now. Given this is only a migration of a 2+ year old markup and CSS that’s been tweaked a few times too many there is certainly cleanup that needs to be done when I get a chance, but a redesign is another challenge for another day.

What I did have to wrestle with was the data migration. The current Textpattern importer plugin seemed a bit out of date and for my needs it needed a bit of customization. The requirements I laid out for a successful migration from Textpattern 4.2.0 to WordPress 3.0.1:

  1. Post author needed to remain my user account in both systems.
  2. Old permalinks needed to work, so /article/[ID]/[textstub] needed to be configured and IDs in the old system needed to be preserved.
  3. Tags needed to be migrated from the old system to the new.
  4. Post Body and Excerpt HTML fields needed to be imported so I didn’t have to configure Textile parsing for all old articles.

Items 1 and 2 required a little massaging before import.

  1. Create the WordPress admin user with the same username as the author in Textpattern.
  2. Delete all test posts, comments and pages from the MySQL database to free up any IDs.

Customization of the textpattern-importer plugin was required to make the rest happen. It wasn’t really a heavy job, but three changes needed to be made.

Swap the use of the Body and Excerpt containing Textile code with the “compiled” Body_html and Excerpt_html fields.

// Get Posts
return $txpdb->get_results('SELECT
	ID,
	Posted,
	AuthorID,
	LastMod,
	Title,
	Body_html,
	Excerpt_html,
	Category1,
	Category2,
	Status,
	Keywords,
	url_title,
	comments_count
	FROM '.$prefix.'textpattern
	', ARRAY_A);

Include the Keywords field (was this just overlooked? I don’t understand why it wasn’t there already). Also, insert the existing ID for each inserted post (as import_id).

$ret_id = wp_insert_post(array(
	'import_id'			=> $OldID,
	'post_date'			=> $Posted,
	'post_date_gmt'		=> $post_date_gmt,
	'post_author'		=> $authorid,
	'post_modified'		=> $LastMod,
	'post_modified_gmt' => $post_modified_gmt,
	'post_title'		=> $Title,
	'post_content'		=> $Body,
	'post_excerpt'		=> $Excerpt,
	'post_status'		=> $post_status,
	'post_name'			=> $url_title,
	'tags_input'		=> $Keywords,
	'comment_count'		=> $comments_count)
	);

What To Do With The Code Now?

I feel the need to share, but is it worth submitting back to the project?

I’ve uploaded both my customized importer plugin and a diff incase anyone else should want to attempt to use it. Please read my requirements above before you do, but it will probably be a smoother transition than the current plugin. I’d love to discuss contributing the changes back into the project with someone, but wouldn’t lobby for it without some discussion of which of my requirements are universal enough to make it (keywords, yes, HTML posts, dunno). Please use the comments section to let me know your thoughts on contributing this code back to WordPress—or report back if you’ve used the code.

Download pnh-textpattern-importer.zip which contains:

  • textpattern-importer.php: (replace contents of /wp-content/plugins/textpattern-importer/textpattern-importer.php with this file after installing existing plugin)
  • textpattern-importer.php.diff

Web2.0 Sucked The Blogging Out Of Me

Molly recently lamented that twitter has sucked the blogging out of her. I’ve been feeling the same way for some time, though I was never as prolific a writer has she is. Though for me I think it was Web 2.0 that has sucked the blogging out of me, and unfortunately the slow down isn’t all that recent.

Bookmarks hidden in one service, interesting news stories in another, photos and other content in yet another. I tried to remedy that with the creation of a tumblelog-like Place Name Where but I never did get it integrated into this site beyond tag searches and so it never felt like part of any discussion that might take place here.

So where to next? The basic tumblelog format doesn’t appeal to me, nor does simply putting a bunch of widgets on page or daily “this is what I bookmarked today” posts along side of any blog content. That kind of leaves most existing solutions behind. I’m not quite sure what form this site will end up in when I’m done or what purpose it will serve. But I do want to start playing again and posting more doodles or pieces of what I’m playing with for others to see.

In the mean time I also have a backlog of posts I’ve been meaning to write or finish writing, some even describing subtle features of the current design [open the site in a browser, not a feed reader and resize the width!]. I may revisit those ideas as a way to get some activity here again and get myself back into the habit of posting on web dev stuff.

My State of Textpattern

Drew McClellan has just posted The State of Textpattern over on his site. Drew is not a core TXP developer, but a long time user who has seen the product change and change hands over its life. His concerns are no surprise to me, as we’ve often gone back and forth over IM trying to ease each other’s frustration with the state of the project.

I think Drew has covered most of my frustrations in his State of Textpattern address. I’ve been using it since the Place Name Here redesign in late 2004, and evaluated it for other projects before and used it since. In that time there are some enhancements to the sites I’ve done via other’s plugins, plugins written myself after I’ve seen a need, times when I’ve done things simply to participate in the community and make it look like it had some life [like the theme contest and been in the code enough to know how it works and make a fair amount of my own customizations.

But as time has passed, like Drew, I find myself both concerned and hesitant about continuing to contribute in any way, or keeping it in future plans for my own sites.

I don’t use the product in my typical day to day web development duties [projects are bigger, using other often custom frameworks or languages besides PHP] but I occasionally find myself with time outside of work that I could offer to the project if the motivation was there.

When motivation and time align – the occasional contributor

The times in the past when both motivation and time have aligned and I’ve made contributions like the microformat plugin. The times more recently when that has been the case, were time and motivation to revise my plugins or look for other things to enhance [hAtom templates or OpenID as examples], I haven’t had enough confidence in the project to justify the effort. “Big” changes that have been talked about forever like admin side redesigning or the decision to include [or not] a particular JS library would have a big impact on how I should approach my code and what features I think are a priority. With no development roadmap in sight [again not a timeline, just a commitment to features or general development direction] and no assurances that what has been done in the so called experimental branch will be there next week I find it impossible to plan my own contributions.

And that’s my own biggest area of frustration for the last few months. My investment in any particular product on my own blogs is light. I could jump to WP or EE or some other solution in a weekend and be done with TXP and onto plotting how to address my peeves with the new platform. The investment in a product that others might be downloading and using is a bit more difficult for me to abandon.

The wrong things take work

As much as the direction [or lack there of] is a concern, its only the latest symptom of a something that has always plagued textpattern.

The way product development has been handled since it was opened up to a larger, more open team, has always been difficult to follow. It is a chore to cover the forums, blogs and mailing lists on a regular basis. That their use by the core team go in spurts and ultimately most of the insight into the product comes in the form of replies to inquiries on the forums or individual code checkins only makes it more difficult. Unless it is your job to do so and you’re building sites with TXP on a day to day basis, the commitment that needs to be made before one can just jump in and be a productive contributor has been too great.

Its nice that a core team has formed over time and they’re now looking for ways to sustain themselves, but I agree 100% that its the the lack of open direction, and the occational feeling from some contributors that direction doesn’t need to be or is somehow in a state of development where it cannot be stated that has me concerned and questioning continued use and support of textpattern.

Released: Textpattern Microformat Plugin v1.2

I’ve just updated my microformat plugin for the textpattern CMS and blogging tool. This update is a maintenance fix to add support for Textpattern v1.0.4 and some changes made in the way tag helpers are built. Users of older versions of TXP should stick with the 1.0 version of the plugin.

Future updates to the plugin are planned to add additional microformats support, expand the flexibility of the tag helpers and to streamline the underlying PHP code. If you’re using this plugin — or have chosen not to — please help by posting a comment letting me know how well you think it fits into your writing style.

How Not To Launch A Redesign

46 days ago I launched a redesign of Place Name Here. New design, new tagging features, some content refreshes and a few promises.

44 days ago I last posted on anything at all.

Tonight I’m looking at the site realizing how far that I’ve let things slide around here and I really need to force myself to get back into the habit of posting. And this doesn’t count.