Make WordPress Core


Ignore:
Timestamp:
02/02/2010 05:37:03 PM (15 years ago)
Author:
ryan
Message:

Allow customizing capabilities for custom post types. Always check caps against those in the post type object instead of contructing them manually. see #9674

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r12887 r12927  
    8686
    8787$post_type_object = get_post_type_object($post_type);
    88 $post_type_cap = $post_type_object->capability_type;
    8988
    9089// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
     
    129128    add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', $post_type, 'normal', 'core');
    130129
    131 if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) )
     130if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->publish_cap ) ) )
    132131    add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', $post_type, 'normal', 'core');
    133132
     
    193192<?php
    194193$sample_permalink_html = get_sample_permalink_html($post->ID);
    195 if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_' . $post_type_cap . 's' ) ) ) { ?>
     194if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->publish_cap ) ) ) { ?>
    196195    <div id="edit-slug-box">
    197196<?php
Note: See TracChangeset for help on using the changeset viewer.