以下のコードの4行目を編集してから、XOOPS_ROOT_PATH/modules/wordpress/wp-admin/フォルダ内に、例えば「mt-export.php」などで保存します。
そして、管理者でログインしてURLを直打ちすれば、、成功するかも。
<?php
global $wpdb;
$output = '';
define('MTEXPORT', ''); // ←ここにMT形式ファイルのフルパスを記載 (cacheフォルダなど、書き込み権限のあるフォルダを指定すること。)
require_once('admin.php');
require("admin-header.php");
require('../wp-config.php');
if ('' == MTEXPORT) {
echo ("You must edit the MTEXPORT line as described to continue.");
break;
}
$tableusers = $wpdb->users[$wp_id];
$tableposts = $wpdb->posts[$wp_id];
$tablepost2cat = $wpdb->post2cat[$wp_id];
$tablecategories = $wpdb->categories[$wp_id];
$tablecomments = $wpdb->comments[$wp_id];
$query = "SELECT p.post_date, p.post_content, p.post_title, u.user_nickname, p.post_status, c.comment_author, c.comment_content, c.comment_author_email, c.comment_author_url, c.comment_date, p2c.category_id, cat.cat_name FROM " .$tablecomments ." c RIGHT JOIN " .$tableposts ." p ON c.comment_post_ID = p.ID LEFT JOIN " .$tableusers ." u ON p.post_author = u.ID LEFT JOIN " .$tablepost2cat ." p2c ON p.ID = p2c.post_id LEFT JOIN " .$tablecategories ." cat ON p2c.category_id =cat.cat_ID ";
$result = $wpdb->query($query);
if ($result){
$i=0;
while( $row = $wpdb->get_row(null,OBJECT,$i)) {
if ($prev_entry == $row->post_date) {
$present_cat = $row->cat_name;
if ($prev_cat == $present_cat) {
if ($row->comment_content) {
$output .= "COMMENT:\n";
$output .= "AUTHOR: ".stripslashes($row->comment_author)."\n";
$output .= "EMAIL: ".stripslashes($row->comment_author_email)."\n";
$output .= "URL: ".stripslashes($row->comment_author_url)."\n";
$output .= "DATE: ".date("m/d/Y h:m:s A",(strtotime($row->comment_date)))."\n";
$output .= stripslashes(str_replace("<br />", "", $row->comment_content))."\n";
$output .= "-----\n";
}
}
} else {
if ($i > 0 ) $output .= "--------\n";
$output .= "\n";
$output .= "AUTHOR: ".stripslashes($row->user_nickname)."\n";
$output .= "TITLE: ".stripslashes($row->post_title)."\n";
$status = stripslashes($row->post_status);
if ($status =='publish') {
$output .= "STATUS: ".$status."\n";
} else {
$output .= "STATUS: draft\n";
}
$date = $row->post_date;
$output .= "DATE: ".date("m/d/Y h:m:s A",(strtotime($date)))."\n";
$output .= "CATEGORY: ".stripslashes($row->cat_name)."\n";
$output .= "-----\n";
$output .= "BODY:\n";
$output .= stripslashes(str_replace("<br />", "", $row->post_content))."\n";
$prev_entry = $row->post_date;
$prev_cat = $row->cat_name;
if ($row->comment_content != "") {
$output .= "-----\n";
$output .= "COMMENT:\n";
$output .= "AUTHOR: ".stripslashes($row->comment_author)."\n";
$output .= "EMAIL: ".stripslashes($row->comment_author_email)."\n";
$output .= "URL: ".stripslashes($row->comment_author_url)."\n";
$output .= "DATE: ".date("m/d/Y h:m:s A",(strtotime($row->comment_date)))."\n";
$output .= stripslashes(str_replace("<br />", "", $row->comment_content))."\n";
$output .= "-----\n";
}
$output .= "\n";
$output .= "--------\n";
}
$i = $i +1;
}
}
if ($fp = fopen(MTEXPORT, 'wb')) {
flock($fp, LOCK_EX);
fwrite($fp, $output);
fclose($fp);
echo ("succeeded to write file (".$i .")");
} else {
echo ("failed to write file");
}
include_once("admin-footer.php");
?>