Changeset 6417

Show
Ignore:
Timestamp:
12/19/07 20:33:27 (9 months ago)
Author:
ryan
Message:

wp.deleteCategory xmlrpc method from josephscott. fixes #4599

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/xmlrpc.php

    r6416 r6417  
    8585            'wp.getCategories'      => 'this:mw_getCategories',     // Alias 
    8686            'wp.newCategory'        => 'this:wp_newCategory', 
     87            'wp.deleteCategory'     => 'this:wp_deleteCategory', 
    8788            'wp.suggestCategories'  => 'this:wp_suggestCategories', 
    8889            'wp.uploadFile'         => 'this:mw_newMediaObject',    // Alias 
     
    493494        // allowed to add a category. 
    494495        set_current_user(0, $username); 
    495         if(!current_user_can("manage_categories", $page_id)) { 
     496        if(!current_user_can("manage_categories")) { 
    496497            return(new IXR_Error(401, __("Sorry, you do not have the right to add a category."))); 
    497498        } 
     
    527528        return($cat_id); 
    528529    } 
     530 
     531    /** 
     532     * WordPress XML-RPC API 
     533     * wp_deleteCategory 
     534     */ 
     535    function wp_deleteCategory($args) { 
     536        $this->escape($args); 
     537 
     538        $blog_id        = (int) $args[0]; 
     539        $username       = $args[1]; 
     540        $password       = $args[2]; 
     541        $category_id    = (int) $args[3]; 
     542 
     543        if( !$this->login_pass_ok( $username, $password ) ) { 
     544            return $this->error; 
     545        } 
     546 
     547        set_current_user(0, $username); 
     548        if( !current_user_can("manage_categories") ) { 
     549            return new IXR_Error( 401, __( "Sorry, you do not the right to delete a category." ) ); 
     550        } 
     551 
     552        return wp_delete_category( $category_id ); 
     553    } 
     554 
    529555 
    530556    /**