xmlrpc plugin to add new add_blog functionality
-
I needed an xmlrpc functionality for add_blog which would use code similar to the admin add blog form for adding a new blog and users based on passed parameters. Since this interface did not exist in the xmlrpc.php file, i assumed that i could create a plugin to do so. Is this possible? Here is an exerpt of my test plugin:
<?php
/*
Plugin Name: XMLRPC_xmlrpc_ext
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A plugin to extend the functionality of the xmlrpc.php file.
Version: 1.0
Author: Tai Ngo
Author URI: http://URI_Of_The_Plugin_Author
*/add_filter(‘xmlrpc_methods’, ‘attach_new_xmlrpc’);
function attach_new_xmlrpc($methods) {
$methods[‘metaWeblog.my_new_add_blog’] = ‘my_new_add_blog’;
return $methods;
}
function my_new_add_blog($args) {
//global $wpdb;
//$this->escape($args);
// do some processing
return “It works!!! Amazing!”;
}
?>This actual code works and returns “It works!!! Amazing!” but when i uncomment the //global $wpdb;, then it complains about parsing my xml. Here is the actual error:
[Fatal Error] :2:2: The markup in the document following the root element must be well-formed.
How can just uncommenting out the //global $wpdb; line cause an xml parse error?
Anybody have a clue?
I make use of the redstone xmlrpc library so i don’t have to worry about make xml data.
- The topic ‘xmlrpc plugin to add new add_blog functionality’ is closed to new replies.