XMLRPC API updates.

git-svn-id: http://svn.automattic.com/wordpress/trunk@4851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-02-01 00:34:33 +00:00
parent 7130a2b1c8
commit e71e25d354
1 changed files with 23 additions and 11 deletions

View File

@ -223,7 +223,7 @@ class wp_xmlrpc_server extends IXR_Server {
"mt_allow_pings" => $allow_pings,
"wp_slug" => $page->post_name,
"wp_password" => $page->post_password,
"wp_author" => $author->user_nicename,
"wp_author" => $author->display_name,
"wp_page_parent_id" => $page->post_parent,
"wp_page_parent_title" => $parent_title,
"wp_page_order" => $page->menu_order,
@ -444,7 +444,6 @@ class wp_xmlrpc_server extends IXR_Server {
if(!$this->login_pass_ok($username, $password)) {
return($this->error);
}
// Get basic info on all users.
$all_users = $wpdb->get_results("
SELECT u.ID id,
@ -953,6 +952,11 @@ class wp_xmlrpc_server extends IXR_Server {
$post_author = $user->ID;
// If an author id was provided then use it instead.
if(!empty($content_struct["wp_author_id"])) {
$post_author = $content_struct["wp_author_id"];
}
$post_title = $content_struct['title'];
$post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
$post_status = $publish ? 'publish' : 'draft';
@ -1081,8 +1085,20 @@ class wp_xmlrpc_server extends IXR_Server {
}
// Only set the post_author if one is set.
if(!empty($content_struct["wp_author"])) {
$post_author = $content_struct["wp_author"];
if(!empty($content_struct["wp_author_id"])) {
$post_author = $content_struct["wp_author_id"];
}
// Only set ping_status if it was provided.
if(isset($content_struct["mt_allow_pings"])) {
switch($content_struct["mt_allow_pings"]) {
case "0":
$ping_status = "closed";
break;
case "1":
$ping_status = "open";
break;
}
}
$post_title = $content_struct['title'];
@ -1111,10 +1127,6 @@ class wp_xmlrpc_server extends IXR_Server {
get_option('default_comment_status')
: $content_struct['mt_allow_comments'];
$ping_status = (empty($content_struct['mt_allow_pings'])) ?
get_option('default_ping_status')
: $content_struct['mt_allow_pings'];
// Do some timestamp voodoo
$dateCreatedd = $content_struct['dateCreated'];
if (!empty($dateCreatedd)) {
@ -1194,7 +1206,7 @@ class wp_xmlrpc_server extends IXR_Server {
'mt_allow_pings' => $allow_pings,
'wp_slug' => $postdata['post_name'],
'wp_password' => $postdata['post_password'],
'wp_author' => $author->user_nicename,
'wp_author' => $author->display_name,
'wp_author_username' => $author->user_login
);
@ -1239,7 +1251,7 @@ class wp_xmlrpc_server extends IXR_Server {
$link = post_permalink($entry['ID']);
// Get the post author info.
$author = get_userdata($entry['ID']);
$author = get_userdata($entry['post_author']);
$allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
$allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
@ -1261,7 +1273,7 @@ class wp_xmlrpc_server extends IXR_Server {
'mt_allow_pings' => $allow_pings,
'wp_slug' => $entry['post_name'],
'wp_password' => $entry['post_password'],
'wp_author' => $author->user_nicename,
'wp_author' => $author->display_name,
'wp_author_username' => $author->user_login
);