Ticket #17109: 17109-2.diff

File 17109-2.diff, 2.0 KB (added by ericmann, 20 months ago)

Uses filters where appropriate.

  • wp-includes/class-wp-xmlrpc-server.php

     
    903903                        return(new IXR_Error(500, __('Sorry, the new category failed.'))); 
    904904                } 
    905905 
    906                 return($cat_id); 
     906                return apply_filters( 'xmlrpc_call_success_wp_newCategory' , $cat_id, $args ); 
    907907        } 
    908908 
    909909        /** 
     
    930930                if ( !current_user_can('manage_categories') ) 
    931931                        return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete a category.' ) ); 
    932932 
    933                 return wp_delete_term( $category_id, 'category' ); 
     933                $status = wp_delete_term( $category_id, 'category' ); 
     934 
     935                if( true == $status ) 
     936                        do_action( 'xmlrpc_call_success_wp_deleteCategory', $category_id, $args ); 
     937 
     938                return $status; 
    934939        } 
    935940 
    936941        /** 
     
    11421147 
    11431148                do_action('xmlrpc_call', 'wp.deleteComment'); 
    11441149 
    1145                 return wp_delete_comment($comment_ID); 
     1150                $status = wp_delete_comment( $comment_ID ); 
     1151 
     1152                if( true == $status ) 
     1153                        do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args ); 
     1154 
     1155                return $status; 
    11461156        } 
    11471157 
    11481158        /** 
     
    12301240                if ( !$result ) 
    12311241                        return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.')); 
    12321242 
     1243                do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args ); 
     1244 
    12331245                return true; 
    12341246        } 
    12351247 
     
    13131325 
    13141326                do_action('xmlrpc_call', 'wp.newComment'); 
    13151327 
    1316                 return wp_new_comment($comment); 
     1328                $comment_ID = wp_new_comment( $comment ); 
     1329 
     1330                return apply_filters( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args ); 
    13171331        } 
    13181332 
    13191333        /** 
     
    31003114                $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id ); 
    31013115                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); 
    31023116 
     3117                do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args ); 
     3118 
    31033119                return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ), 'upload' ); 
    31043120        } 
    31053121