Make WordPress Core

Ticket #16714: 16714.11.diff

File 16714.11.diff, 4.9 KB (added by nacin, 12 years ago)

Remove the awkward meta cap, which isn't filterable anyway, because most references are to the post type object.

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

     
    10161016                        if ( $post_data['post_type'] != get_post_type( $post_data['ID'] ) )
    10171017                                return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
    10181018                } else {
    1019                         if ( ! current_user_can( $post_type->cap->edit_posts ) )
     1019                        if ( ! current_user_can( $post_type->cap->create_posts ) || ! current_user_can( $post_type->cap->edit_posts ) )
    10201020                                return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) );
    10211021                }
    10221022
     
    39283928                do_action('xmlrpc_call', 'blogger.newPost');
    39293929
    39303930                $cap = ($publish) ? 'publish_posts' : 'edit_posts';
    3931                 if ( !current_user_can($cap) )
     3931                if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) || !current_user_can($cap) )
    39323932                        return new IXR_Error(401, __('Sorry, you are not allowed to post on this site.'));
    39333933
    39343934                $post_status = ($publish) ? 'publish' : 'draft';
     
    41434143                        $post_type = 'post';
    41444144                }
    41454145
     4146                if ( ! current_user_can( get_post_type_object( $post_type )->cap->create_posts ) )
     4147                        return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts on this site.' ) );
    41464148                if ( !current_user_can( $cap ) )
    41474149                        return new IXR_Error( 401, $error_message );
    41484150
  • wp-includes/capabilities.php

     
    10601060                                $caps[] = $post_type->cap->delete_private_posts;
    10611061                }
    10621062                break;
    1063         // current_user_can( 'create_posts', $post_type )
    1064         case 'create_posts':
    1065                 $post_type = isset( $args[0] ) ? $args[0] : 'post';
    1066                 $post_type_object = get_post_type_object( $post_type );
    1067 
    1068                 $caps[] = $post_type_object->cap->create_posts;
    1069 
    1070                 break;
    10711063                // edit_post breaks down to edit_posts, edit_published_posts, or
    10721064                // edit_others_posts
    10731065        case 'edit_post':
  • wp-admin/index.php

     
    7676        $help .= '<p>' . __('<strong>Recent Comments</strong> - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.') . '</p>';
    7777if ( current_user_can( 'publish_posts' ) )
    7878        $help .= '<p>' . __('<strong>Incoming Links</strong> - Shows links to your site found by Google Blog Search.') . '</p>';
    79 if ( current_user_can( 'create_posts' ) ) {
     79if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
    8080        $help .= '<p>' . __('<strong>QuickPress</strong> - Allows you to create a new post and either publish it or save it as a draft.') . '</p>';
    8181        $help .= '<p>' . __('<strong>Recent Drafts</strong> - Displays links to the 5 most recent draft posts you&#8217;ve started.') . '</p>';
    8282}
  • wp-admin/menu.php

     
    4949$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'none' );
    5050        $submenu['edit.php'][5]  = array( __('All Posts'), 'edit_posts', 'edit.php' );
    5151        /* translators: add new post */
    52         $submenu['edit.php'][10]  = array( _x('Add New', 'post'), 'create_posts', 'post-new.php' );
     52        $submenu['edit.php'][10]  = array( _x('Add New', 'post'), get_post_type_object( 'post' )->cap->create_posts, 'post-new.php' );
    5353
    5454        $i = 15;
    5555        foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
     
    8181$menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'none' );
    8282        $submenu['edit.php?post_type=page'][5] = array( __('All Pages'), 'edit_pages', 'edit.php?post_type=page' );
    8383        /* translators: add new page */
    84         $submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), 'edit_pages', 'post-new.php?post_type=page' );
     84        $submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), get_post_type_object( 'page' )->cap->create_posts, 'post-new.php?post_type=page' );
    8585        $i = 15;
    8686        foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
    8787                if ( ! $tax->show_ui || ! in_array('page', (array) $tax->object_type, true) )
  • wp-admin/press-this.php

     
    1313
    1414header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    1515
    16 if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( 'create_posts' ) )
     16if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object('post')->cap->create_posts ) )
    1717        wp_die( __( 'Cheatin&#8217; uh?' ) );
    1818
    1919/**