Make WordPress Core

Changeset 22908


Ignore:
Timestamp:
11/28/2012 10:28:20 PM (12 years ago)
Author:
nacin
Message:

Use the create_posts post type cap in more places. Remove the janky create_posts meta cap. see #16714.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/index.php

    r22812 r22908  
    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>';
  • trunk/wp-admin/menu.php

    r22900 r22908  
    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;
     
    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 ) {
  • trunk/wp-admin/press-this.php

    r22427 r22908  
    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
  • trunk/wp-includes/admin-bar.php

    r22900 r22908  
    364364        ) );
    365365
    366         if ( current_user_can( 'edit_posts' ) ) {
     366        if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
    367367            $wp_admin_bar->add_menu( array(
    368368                'parent' => $menu_id,
     
    371371                'href'   => admin_url( 'post-new.php' ),
    372372            ) );
     373        }
     374
     375        if ( current_user_can( 'edit_posts' ) ) {
    373376            $wp_admin_bar->add_menu( array(
    374377                'parent' => $menu_id,
  • trunk/wp-includes/capabilities.php

    r22418 r22908  
    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
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r22622 r22908  
    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        }
     
    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
     
    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 );
Note: See TracChangeset for help on using the changeset viewer.