WordPress.org

Make WordPress Core

Ticket #16714: 16714.5.diff

File 16714.5.diff, 4.7 KB (added by ryan, 3 years ago)

add-new.diff with some additions

  • wp-includes/post.php

     
    14111411                'edit_others_posts'  => 'edit_others_'  . $plural_base, 
    14121412                'publish_posts'      => 'publish_'      . $plural_base, 
    14131413                'read_private_posts' => 'read_private_' . $plural_base, 
    1414                 // Post creation capability simply maps to edit_posts by default: 
    1415                 'create_posts'       => 'edit_'         . $plural_base, 
    14161414        ); 
    14171415 
     1416        // Post creation capability simply maps to edit_posts by default: 
     1417        if ( ! isset( $args->capabilities['create_posts'] ) ) 
     1418                $default_capabilities['create_posts'] = 'edit_' . $plural_base; 
     1419 
    14181420        // Primitive capabilities used within map_meta_cap(): 
    14191421        if ( $args->map_meta_cap ) { 
    14201422                $default_capabilities_for_mapping = array( 
  • wp-admin/post-new.php

     
    3636 
    3737$editing = true; 
    3838 
    39 if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) 
     39if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) ) 
    4040        wp_die( __( 'Cheatin’ uh?' ) ); 
    4141 
    4242// Schedule auto-draft cleanup 
  • 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( 'edit_posts' ) ) { 
     79if ( current_user_can( '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/edit-form-advanced.php

     
    274274 
    275275<div class="wrap"> 
    276276<?php screen_icon(); ?> 
    277 <h2><?php echo esc_html( $title ); ?><?php if ( isset( $post_new_file ) ) : ?> <a href="<?php echo esc_url( $post_new_file ) ?>" class="add-new-h2"><?php echo esc_html($post_type_object->labels->add_new); ?></a><?php endif; ?></h2> 
     277<h2><?php 
     278echo esc_html( $title ); 
     279if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) 
     280        echo ' <a href="' . esc_url( $post_new_file ) . '" class="add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; 
     281?></h2> 
    278282<?php if ( $notice ) : ?> 
    279283<div id="notice" class="error"><p><?php echo $notice ?></p></div> 
    280284<?php endif; ?> 
  • wp-admin/edit.php

     
    221221?> 
    222222<div class="wrap"> 
    223223<?php screen_icon(); ?> 
    224 <h2><?php echo esc_html( $post_type_object->labels->name ); ?> <a href="<?php echo $post_new_file ?>" class="add-new-h2"><?php echo esc_html($post_type_object->labels->add_new); ?></a> <?php 
     224<h2><?php 
     225echo esc_html( $post_type_object->labels->name ); 
     226if ( current_user_can( $post_type_object->cap->create_posts ) ) 
     227        echo ' <a href="' . esc_url( $post_new_file ) . '" class="add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; 
    225228if ( ! empty( $_REQUEST['s'] ) ) 
    226         printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?> 
    227 </h2> 
     229        printf( ' <span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); 
     230?></h2> 
    228231 
    229232<?php if ( isset( $_REQUEST['locked'] ) || isset( $_REQUEST['updated'] ) || isset( $_REQUEST['deleted'] ) || isset( $_REQUEST['trashed'] ) || isset( $_REQUEST['untrashed'] ) ) { 
    230233        $messages = array(); 
  • 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') ) 
     16if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( 'create_posts' ) ) 
    1717        wp_die( __( 'Cheatin&#8217; uh?' ) ); 
    1818 
    1919/**