[wp-testers] wp_newCategory in xmlrpc not working properly
grmark
grmark at gmail.com
Wed Dec 3 06:58:03 GMT 2008
Hi all
Anyone notice the wp_newCategory method is not working properly
from xmlrpc.php file here is what args it accepts
function wp_newCategory($args) {
$this->escape($args);
$blog_id =3D (int) $args[0];
$username =3D $args[1];
$password =3D $args[2];
$category =3D $args[3];
if(!$this->login_pass_ok($username, $password)) {
return($this->error);
}
etc...
Then I make request using this code
include ("xmlrpc.inc");
$blogURL=3Dhttp://myblogurl.com/;
$xmlrpc_url=3D$blogURL."xmlrpc.php";
$client =3D new xmlrpc_client($xmlrpc_url);
$category=3D"WordPress";
$params=3Darray();
$params[] =3D new xmlrpcval("n/a");
$params[] =3D new xmlrpcval($username);=20
$params[] =3D new xmlrpcval($password);=20
$params[] =3D new xmlrpcval($category);
$msg =3D new xmlrpcmsg("wp.newCategory",$params);
$client->accepted_compression=3Darray();
$response =3D $client->send($msg);
it returns new catgory ID but what I get in WordPress blog is a category =
name "W"
what I do to get this method works is modify the xmlrpc function
function wp_newCategory($args) {
$this->escape($args);
$blog_id =3D (int) $args[0];
$username =3D $args[1];
$password =3D $args[2];
$category["name"] =3D $args[3];
$category["slug"] =3D $args[4];
$category["parent_id"] =3D $args[5];
$category["description"] =3D $args[6];
and make request using this code
include ("xmlrpc.inc");
$blogURL=3Dhttp://myblogurl.com/;
$xmlrpc_url=3D$blogURL."xmlrpc.php";
$client =3D new xmlrpc_client($xmlrpc_url);
$category=3D"WordPress";
$params=3Darray();
$params[] =3D new xmlrpcval("n/a");
$params[] =3D new xmlrpcval($_POST['Email']);=20
$params[] =3D new xmlrpcval($_POST['Passwd']);=20
$params[] =3D new xmlrpcval($category);
$params[] =3D new xmlrpcval($cat_slug);
$params[] =3D new xmlrpcval($parent_cat);
$params[] =3D new xmlrpcval($category);
$msg =3D new xmlrpcmsg("wp.newCategory",$params);
$client->accepted_compression=3Darray();
$response =3D $client->send($msg);
then I get "WordPress" as new category
I may do something wrong but please someone prove that I m doing wrong
Lee
More information about the wp-testers
mailing list