WordPress.org

Make WordPress Core

Ticket #20474: _insert_post cap fixes.patch

File _insert_post cap fixes.patch, 1.8 KB (added by nprasath002, 3 years ago)
  • class-wp-xmlrpc-server.php

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: C:\xampp\htdocs\wordtrunk\wp-includes
    # This patch can be applied using context Tools: Patch action on respective folder.
    # It uses platform neutral UTF-8 encoding and \n newlines.
    # Above lines and this line are ignored by the patching process.
     
    785785                        case 'pending': 
    786786                                break; 
    787787                        case 'private': 
     788                                if ( $update ) { 
     789                                        if ( ! current_user_can( $post_type->cap->publish_post, $post_data[ 'ID' ] ) ) 
     790                                                return new IXR_Error( 401, __( 'Sorry, you are not allowed to set this post as private.' ) ); 
     791                                } else { 
    788792                                if ( ! current_user_can( $post_type->cap->publish_posts ) ) 
    789793                                        return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' )); 
     794                                } 
    790795                                break; 
    791796                        case 'publish': 
    792797                        case 'future': 
     798                                if ( $update ) { 
     799                                        if ( ! current_user_can( $post_type->cap->publish_post, $post_data[ 'ID' ] ) ) 
     800                                                return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this post.' ) ); 
     801                                } else { 
    793802                                if ( ! current_user_can( $post_type->cap->publish_posts ) ) 
    794803                                        return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' )); 
     804                                } 
    795805                                break; 
    796806                        default: 
    797807                                $post_data['post_status'] = 'draft';