Wednesday, January 9, 2008

Getting posts from bBlog to WordPress

I was able to reconnect my bBlog mySQL database to the new server and was trying to figure out how to copy the data over. My intention was to get the posts either through phpmyadmin, copy the content to a new post and then modify the post date. While searching for information I ran into a great little SQL script that moved everything over for me. I had to tweak it a bit it worked great! I am still doing cleanup fixing the old markup code but it's good to see the old posts. I am still having trouble with the code tag working properly and exploring plug-ins to give me a scrolling code quoting box. I had to modify the script a little for the additional fields in this version of wordpress. Here is the original post.

[code lang='vb']
INSERT INTO wordpress.wp_posts (ID, post_author, post_date, post_date_gmt,
  post_content, post_title, post_category, post_modified,
  post_modified_gmt, post_excerpt, to_ping, pinged, post_content_filtered)
  SELECT postid, 1 as author, FROM_UNIXTIME(posttime),
  DATE_ADD(FROM_UNIXTIME(posttime), INTERVAL -7 HOUR), body,
  title, 0 as category, NOW(), DATE_ADD(NOW(), INTERVAL -7 HOUR), '', '', '', ''
  FROM bb_posts;
[/code]

No comments:

Post a Comment