WordPress.org

Making WordPress.org

Changeset 6183


Ignore:
Timestamp:
11/27/17 23:56:25 (3 weeks ago)
Author:
coreymckrill
Message:

WordCamp Post Type: Change capability type for the post Type

Instead of the default edit_posts etc., this sets the capability
type for WCPT to wordcamp, so the caps become edit_wordcamps etc.
This allows for more granular permissions for content editing and
supports the new WordCamp Wrangler subrole.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/views/wordcamp/metabox-status.php

    r2877 r6183  
    1 <?php defined( 'WPINC' ) or die(); ?> 
     1<?php 
     2defined( 'WPINC' ) || die(); 
     3 
     4$wcpt = get_post_type_object( WCPT_POST_TYPE_ID ); 
     5?> 
    26 
    37<div id="submitpost" class="wcb submitbox"> 
     
    812                    WordCamp Status: 
    913 
    10                     <?php if ( current_user_can( 'manage_network' ) ) : ?> 
     14                    <?php if ( current_user_can( $wcpt->cap->edit_posts ) ) : ?> 
    1115 
    1216                        <span id="post-status-display"> 
     
    4852    <div id="major-publishing-actions"> 
    4953        <div id="delete-action"> 
    50             <?php if ( current_user_can( 'delete_post', $post->ID ) ) : ?> 
     54            <?php if ( current_user_can( $wcpt->cap->delete_post, $post->ID ) ) : ?> 
    5155                <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>"> 
    5256                    <?php _e( 'Delete', 'wordcamporg' ); ?> 
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php

    r6160 r6183  
    102102        ); 
    103103 
    104         // Notes are private, so only show them to network admins 
    105         if ( current_user_can( 'manage_network' ) ) { 
     104        // Notes are private, so only show them to WordCamp Wranglers 
     105        if ( current_user_can( 'wordcamp_wrangle_wordcamps' ) ) { 
    106106            add_meta_box( 
    107107                'wcpt_notes', 
     
    843843 
    844844        if ( ! empty( $post_data['post_status'] ) ) { 
    845             // Only network admins can change WordCamp statuses. 
    846             if ( ! current_user_can( 'manage_network' ) ) { 
     845            $wcpt = get_post_type_object( WCPT_POST_TYPE_ID ); 
     846 
     847            // Only WordCamp Wranglers can change WordCamp statuses. 
     848            if ( ! current_user_can( $wcpt->cap->edit_posts ) ) { 
    847849                $post_data['post_status'] = $post->post_status; 
    848850            } 
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-loader.php

    r4804 r6183  
    103103            'show_ui'               => true, 
    104104            'can_export'            => true, 
    105             'capability_type'       => 'post', 
     105            'capability_type'       => WCPT_POST_TYPE_ID, 
     106            'map_meta_cap'          => true, 
    106107            'hierarchical'          => false, 
    107108            'has_archive'           => true, 
Note: See TracChangeset for help on using the changeset viewer.