From 094a435382c1aff3293d79c1706924c9be08a531 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 19 Jan 2009 19:22:26 +0000 Subject: [PATCH] Provide access to sticky status via XMLRPC. Props josephscott. see #8777 git-svn-id: https://develop.svn.wordpress.org/trunk@10382 602fd350-edb4-49c9-b593-d223f7449a82 --- xmlrpc.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/xmlrpc.php b/xmlrpc.php index c45b14fac7..c185bafe5e 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -2219,6 +2219,13 @@ class wp_xmlrpc_server extends IXR_Server { return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); } + // Only posts can be sticky + if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) + if ( $content_struct['sticky'] == true ) + stick_post( $post_ID ); + elseif ( $content_struct['sticky'] == false ) + unstick_post( $post_ID ); + if ( isset($content_struct['custom_fields']) ) { $this->set_custom_fields($post_ID, $content_struct['custom_fields']); } @@ -2502,6 +2509,13 @@ class wp_xmlrpc_server extends IXR_Server { return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.')); } + // Only posts can be sticky + if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) + if ( $content_struct['sticky'] == true ) + stick_post( $post_ID ); + elseif ( $content_struct['sticky'] == false ) + unstick_post( $post_ID ); + if ( isset($content_struct['custom_fields']) ) { $this->set_custom_fields($post_ID, $content_struct['custom_fields']); } @@ -2580,6 +2594,10 @@ class wp_xmlrpc_server extends IXR_Server { $postdata['post_status'] = 'publish'; } + $sticky = false; + if ( is_sticky( $post_ID ) ) + $sticky = true; + $enclosure = array(); foreach ( (array) get_post_custom($post_ID) as $key => $val) { if ($key == 'enclosure') { @@ -2615,7 +2633,8 @@ class wp_xmlrpc_server extends IXR_Server { 'wp_author_display_name' => $author->display_name, 'date_created_gmt' => new IXR_Date($post_date_gmt), 'post_status' => $postdata['post_status'], - 'custom_fields' => $this->get_custom_fields($post_ID) + 'custom_fields' => $this->get_custom_fields($post_ID), + 'sticky' => $sticky ); if (!empty($enclosure)) $resp['enclosure'] = $enclosure;