At ranchocommunity.org, which is currently being converted from a Drupal site to a Wordpress site, all of our sermon content is stored in a custom content type created with CCK. PodsCMS is a plugin for Wordpress that provides similar functionality. The trick was how would I convert the data? I certainly don’t want to re-input a couple year’s worth of sermons by hand. But since all that data is stored in MySQL databases, it is accessible. It’s just a matter of putting the right data in the right places. Here’s how I did it.
Note: I need to make a disclaimer here. This post is mostly a walkthrough of how I managed to do this, along with some bits of information that I learned along the way. If you plan on doing this yourself, you’re going to need to adapt just about everything to fit your needs. I’m going to walk you through the information that you’ll need to know first, then the script I used is available at the bottom of this post for you to use a starting point.
First, I used the Drupal Node Export module to export all of the sermons from Drupal. That gave me an array that looked something like this:
array(
array(
// *snip* Lots of data
)
);
I assigned that to a variable that became the source of all our my Drupal content.
$nodes = array(
array(
// *snip* Lots of data
)
);
My new pod type is called a ’sermon’ and it looks like this:

In my Wordpress database, there is a corresponding table called wp_pod_tbl_sermons:

See all of my fields (besides the picks, which we’ll get to in a bit) are there. The script takes the appropriate fields from $nodes and inserts them into the table.
There’s another table that we have to worry about called wp_pod. This is more of a master list of all of your pods, and it points back to a wp_pod_tbl_podtype table.

This table takes a little more work to fill in because a good chunk of the data isn’t in $nodes. First, tbl_row_id comes from the id of the corresponding row in wp_pod_tbl_sermons. I found that by selecting the newest row from that table.
$sql = "SELECT id FROM wp_pod_tbl_sermons ORDER BY id DESC LIMIT 1";
$result = mysql_query($sql) or die (mysql_error());
$id = mysql_fetch_array($result);
datatype comes from the table wp_pod_types. Since I am only importing one type of pod, I just hardcoded this value to be set to the id of sermons, which was 3.
name and created come from $nodes, id and modified set themselves.
Now on to those picks that I mentioned earlier. My sermons link to two other pod types: series, and speakers. Pods stores all of the information for all of the picks, regardless of what pod type they’re in, in the table wp_pod_rel.

pod_id is a reference to a row in wp_pod. I got this information the same way I got the id from wp_pod_tbl_sermons:
$sql = "SELECT id FROM wp_pods ORDER BY id DESC LIMIT 1";
$result = mysql_query($sql) or die (mysql_error());
$id = mysql_fetch_array($result);
field_id is a reference to which type of pick field we’re talking about, and the values are in the table wp_pod_fields. In my case there are two types, series and speakers, which have the ids 11 and 14 in wp_pod_fields. tbl_row_id references the row in the wp_pod_tbl_podtype that this sermon has “picked.”
Here’s what I did with this: The script looks at the current row in $node and finds the series for that sermon. Then there is a simple switch statement to decide what value to use for tbl_row_id based on what the series was. After it has those two bits of information, it adds another row to wp_pod_rel with field_id set to 11 and tbl_row_id set based off the switch statement.
That last process is then repeated for speakers, but this time field_id is set to 14, and tbl_row_id reference a row in wp_pod_tbl_sermons.
I’m not sure what sister_pod is all about. It was 0 on every one of my pods. It must be for some feature I haven’t found yet.
Here’s the cheat sheet I made of all the tables and fields I had to worry about.

And finally, the actual script. I hope this all made sense and is helpful. This could even be the ground work for a more universally useful migration-script if someone (me?) gets around to writing it. Feel free to leave questions in the comments.
<?php
/* Drupal CCK -> Wordpress PodsCMS migration tool.
*
* This is the script I used for my specific install. If you plan on using this,
* you will need to customize the heck out of it.
*
* You can email me questions at danielmurphy02@gmail.com or leave a comment at
* worshiptechie.com . I'm also on Twitter: @worshiptechie.
*
*/
?>
<pre>
<?php
// The drupal node export is being assigned to $node in a separate file.
include('migrate_data.php');
$con = mysql_connect('localhost:8889','root','root');
if (!$con) die ('could not connect: '. mysql_error());
mysql_select_db("wordpress");
// $wp_pod_tbl_sermons gets populated, then inserted as a new row into
// wp_pod_tbl_sermons.
foreach ($nodes as $row) {
$wp_pod_tbl_sermons['name'] = $row['title'];
$wp_pod_tbl_sermons['body'] = ($row['body'] != "") ? $row['body'] : $row['title'];
$wp_pod_tbl_sermons['mp3'] = ($row['field_sermon_mp3'][0]['filename'] != "")
? "/wp-content/messages/audio/".$row['field_sermon_mp3'][0]['filename']
: "";
$wp_pod_tbl_sermons['m4a'] = ($row['field_sermon_m4a'][0]['filename'] != "")
? "/wp-content/messages/audio/".$row['field_sermon_m4a'][0]['filename']
: "";
$wp_pod_tbl_sermons['video']= ($row['field_sermon_video_link'][0]['value'] != "")
? $row['field_sermon_video_link'][0]['value']
: "";
$wp_pod_tbl_sermons['notes']= ($row['field_sermon_notes'][0]['filename'] != "")
? "/wp-content/messages/notes/".$row['field_sermon_notes'][0]['filename']
: "";
print "pw_pod_tbl_sermons<br />";
print_r($wp_pod_tbl_sermons);
$sql = "INSERT INTO wp_pod_tbl_sermons (name, body, mp3, m4a, video, notes)
VALUES('" . mysql_real_escape_string($wp_pod_tbl_sermons['name'])."',
'" . mysql_real_escape_string($wp_pod_tbl_sermons['body']) . "',
'" . $wp_pod_tbl_sermons['mp3'] . "',
'" . $wp_pod_tbl_sermons['m4a'] . "',
'" . $wp_pod_tbl_sermons['video'] . "',
'" . $wp_pod_tbl_sermons['notes'] . "'
)";
mysql_query($sql) or die (mysql_error());
// Get the id of the row that we just inserted, and assign it to $id.
$sql = "SELECT id FROM wp_pod_tbl_sermons ORDER BY id DESC LIMIT 1";
$result = mysql_query($sql) or die (mysql_error());
$id = mysql_fetch_array($result);
// $wp_pod get populated and inserted into wp_pod.
$wp_pod['tbl_row_id'] = $id['id'];
$wp_pod['datatype'] = '3';
$wp_pod['name'] = $wp_pod_tbl_sermons['name'];
$wp_pod['created'] = date("Y-m-d H:i:s", $row['created'] - 3600);
print "<br />wp_pod<br />";
print_r($wp_pod);
$sql = "INSERT INTO wp_pod (tbl_row_id, datatype, name, created)
VALUES('" . $wp_pod['tbl_row_id']."',
'" . $wp_pod['datatype']. "',
'" . mysql_real_escape_string($wp_pod['name'])."',
'" . $wp_pod['created']."'
)";
mysql_query($sql) or die (mysql_error());
// Get the id of the row that we just inserted, and assign it to $id.
$sql = "SELECT id FROM wp_pod ORDER BY id DESC LIMIT 1";
$result = mysql_query($sql) or die (mysql_error());
$id = mysql_fetch_array($result);
// $wp_rel get populated and inserted into wp_rel.
$wp_pod_rel['pod_id'] = $id['id'];
$wp_pod_rel['sister_pod_id'] = 0;
$wp_pod_rel['field_id'] = 11;
switch ($row['field_sermon_series'][0]['value']) {
case 'Isaiah':
$wp_pod_rel['tbl_row_id'] = 2;
break;
case 'Thriving in the Storm':
$wp_pod_rel['tbl_row_id'] = 3;
break;
case 'Grace Works':
$wp_pod_rel['tbl_row_id'] = 4;
break;
case 'Joy in Tough Times':
$wp_pod_rel['tbl_row_id'] = 5;
break;
case 'The Glory of God':
$wp_pod_rel['tbl_row_id'] = 6;
break;
case 'A Life of Greatest Value':
$wp_pod_rel['tbl_row_id'] = 7;
break;
default:
$wp_pod_rel['tbl_row_id'] = 1;
break;
}
print "<br />wp_pod_rel<br />";
print_r($wp_pod_rel);
$sql = "INSERT INTO wp_pod_rel (pod_id, sister_pod_id, field_id, tbl_row_id)
VALUES('" . $wp_pod_rel['pod_id']."',
'" . $wp_pod_rel['sister_pod_id']. "',
'" . $wp_pod_rel['field_id']."',
'" . $wp_pod_rel['tbl_row_id']."'
)";
mysql_query($sql) or die (mysql_error());
// repeat the proces for the second pick field.
$wp_pod_rel['field_id'] = 14;
switch ($row['name']) {
case 'Scott Treadway':
$wp_pod_rel['tbl_row_id'] = 1;
break;
case 'Sabo Cortez':
$wp_pod_rel['tbl_row_id'] = 2;
break;
case 'Steve Salomon':
$wp_pod_rel['tbl_row_id'] = 3;
break;
default:
$wp_pod_rel['tbl_row_id'] = 4;
break;
}
print "<br />wp_pod_rel<br />";
print_r($wp_pod_rel);
print "<hr />";
$sql = "INSERT INTO wp_pod_rel (pod_id, sister_pod_id, field_id, tbl_row_id)
VALUES('" . $wp_pod_rel['pod_id']."',
'" . $wp_pod_rel['sister_pod_id']. "',
'" . $wp_pod_rel['field_id']."',
'" . $wp_pod_rel['tbl_row_id']."'
)";
mysql_query($sql) or die (mysql_error());
}
?>
</pre>