WordPress.org

Make WordPress Core

Changeset 22060


Ignore:
Timestamp:
09/27/2012 03:33:19 PM (6 years ago)
Author:
ryan
Message:

Introduce create_posts meta capability. Props scribu, nacin, casben79. see #16714

Location:
trunk
Files:
3 edited

Legend:

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

    r21948 r22060  
    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'), 'edit_posts', 'post-new.php' );
     52    $submenu['edit.php'][10]  = array( _x('Add New', 'post'), 'create_posts', 'post-new.php' );
    5353
    5454    $i = 15;
  • trunk/wp-includes/capabilities.php

    r22056 r22060  
    10471047        }
    10481048        break;
     1049    // current_user_can( 'create_posts', $post_type )
     1050    case 'create_posts':
     1051        $post_type = isset( $args[0] ) ? $args[0] : 'post';
     1052        $post_type_object = get_post_type_object( $post_type );
     1053
     1054        $caps[] = $post_type_object->cap->create_posts;
     1055
     1056        break;
    10491057        // edit_post breaks down to edit_posts, edit_published_posts, or
    10501058        // edit_others_posts
  • trunk/wp-includes/post.php

    r21981 r22060  
    12971297        'publish_posts'      => 'publish_'      . $plural_base,
    12981298        'read_private_posts' => 'read_private_' . $plural_base,
     1299        // Post creation capability simply maps to edit_posts by default:
     1300        'create_posts'       => 'edit_'         . $plural_base,
    12991301    );
    13001302
Note: See TracChangeset for help on using the changeset viewer.