family journal
XMLRPC Patch for WordPress 2.9.1
The latest release of WordPress 2.9.1 has a minor bug in the xmlrpc.php file which prevents the user from creating a new post remotely. There are quite a lot of issues with the xmlrpc.php, one being that the xml returned is not well-formed and the other is calling an method on an array.
I ran across these issues when I was trying to import some posts into WordPress using XMLRPC with Zend_XmlRpc_Client.
Anyway, the patch here will allow you to insert the post:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | Index: xmlrpc.php =================================================================== @@ -2195,13 +2195,16 @@ // Do some timestamp voodoo if ( !empty( $content_struct['date_created_gmt'] ) ) - $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force + $dateCreated = $content_struct['date_created_gmt']; elseif ( !empty( $content_struct['dateCreated']) ) - $dateCreated = $content_struct['dateCreated']->getIso(); + $dateCreated = $content_struct['dateCreated']; + if ( !empty( $dateCreated ) ) { - $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); - $post_date_gmt = iso8601_to_datetime($dateCreated, GMT); + $dateIXR = new IXR_Date(strtotime($dateCreated)); + $dateCreated = $dateIXR->getIso(); + $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); + $post_date_gmt = iso8601_to_datetime($dateCreated. "Z", GMT); } else { $post_date = current_time('mysql'); $post_date_gmt = current_time('mysql', 1); |
Copy the above code to a file, call it xmlrpc.patch. To patch the content of xmlrpc.php which is located say under directory public:
1 | ~/public$ patch -p0 < xmlrpc.patch |
| Print article | This entry was posted by amu on January 21, 2010 at 2:29 am, and is filed under Techie Stuff. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 9 months ago
Bravo, l’idГ©e brillante et est opportun
about 7 months ago
Awsome website ! I will mark it in my favorites. thank you