Skip to content

Commit 4d4e6b5

Browse files
committed
More XML-RPC API enhancements from Joseph Scott.
git-svn-id: https://develop.svn.wordpress.org/trunk@4833 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 53b8aa1 commit 4d4e6b5

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

xmlrpc.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,11 +1075,16 @@ function mw_editPost($args) {
10751075
$post_parent = $content_struct["wp_page_parent_id"];
10761076
}
10771077

1078-
// Only ste the menu_order if it was given.
1078+
// Only set the menu_order if it was given.
10791079
if(!empty($content_struct["wp_page_order"])) {
10801080
$menu_order = $content_struct["wp_page_order"];
10811081
}
10821082

1083+
// Only set the post_author if one is set.
1084+
if(!empty($content_struct["wp_author"])) {
1085+
$post_author = $content_struct["wp_author"];
1086+
}
1087+
10831088
$post_title = $content_struct['title'];
10841089
$post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
10851090
$catnames = $content_struct['categories'];
@@ -1122,7 +1127,7 @@ function mw_editPost($args) {
11221127
}
11231128

11241129
// We've got all the data -- post it:
1125-
$newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order');
1130+
$newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author');
11261131

11271132
$result = wp_update_post($newpost);
11281133
if (!$result) {
@@ -1233,6 +1238,9 @@ function mw_getRecentPosts($args) {
12331238
$post = get_extended($entry['post_content']);
12341239
$link = post_permalink($entry['ID']);
12351240

1241+
// Get the post author info.
1242+
$author = get_userdata($entry['ID']);
1243+
12361244
$allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
12371245
$allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
12381246

@@ -1250,7 +1258,11 @@ function mw_getRecentPosts($args) {
12501258
'mt_excerpt' => $entry['post_excerpt'],
12511259
'mt_text_more' => $post['extended'],
12521260
'mt_allow_comments' => $allow_comments,
1253-
'mt_allow_pings' => $allow_pings
1261+
'mt_allow_pings' => $allow_pings,
1262+
'wp_slug' => $entry['post_name'],
1263+
'wp_password' => $entry['post_password'],
1264+
'wp_author' => $author->user_nicename,
1265+
'wp_author_username' => $author->user_login
12541266
);
12551267

12561268
}

0 commit comments

Comments
 (0)