WordPress.org

Making WordPress.org


Ignore:
Timestamp:
11/27/2017 11:56:25 PM (8 months 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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            }
Note: See TracChangeset for help on using the changeset viewer.