WordPress.org

Making WordPress.org

Changeset 6186


Ignore:
Timestamp:
11/28/17 19:22:32 (2 weeks ago)
Author:
coreymckrill
Message:

WordCamp Post Type: Fix editing permission issues

In [meta6183] the capability type of WCPT was changed, which caused post
authors (lead organizers) to not be able to edit details in their posts.
This commit restores that ability by adding the edit_wordcamps capability
to several site roles.

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

    r6183 r6186  
    1212                    WordCamp Status: 
    1313 
    14                     <?php if ( current_user_can( $wcpt->cap->edit_posts ) ) : ?> 
     14                    <?php if ( current_user_can( 'wordcamp_wrangle_wordcamps' ) ) : ?> 
    1515 
    1616                        <span id="post-status-display"> 
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php

    r6183 r6186  
    846846 
    847847            // Only WordCamp Wranglers can change WordCamp statuses. 
    848             if ( ! current_user_can( $wcpt->cap->edit_posts ) ) { 
     848            if ( ! current_user_can( 'wordcamp_wrangle_wordcamps' ) ) { 
    849849                $post_data['post_status'] = $post->post_status; 
    850850            } 
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-loader.php

    r6183 r6186  
    2424        add_action( 'plugins_loaded',                  array( $this, 'includes'                          ) ); 
    2525        add_action( 'init',                            array( $this, 'register_post_types'               ) ); 
     26        add_action( 'init',                            array( $this, 'register_post_capabilities'        ) ); 
    2627        add_action( 'init',                            array( $this, 'register_post_statuses'            ) ); 
    2728        add_filter( 'pre_get_posts',                   array( $this, 'query_public_statuses_on_archives' ) ); 
     
    113114            'rest_controller_class' => 'WordCamp_REST_WordCamps_Controller', 
    114115        ) ); 
     116    } 
     117 
     118    /** 
     119     * Allow some site roles to see WordCamp posts. 
     120     */ 
     121    public function register_post_capabilities() { 
     122        $roles = array( 
     123            'contributor', 
     124            'author', 
     125            'editor', 
     126            'administrator', 
     127        ); 
     128 
     129        foreach ( $roles as $role ) { 
     130            get_role( $role )->add_cap( 'edit_wordcamps' ); 
     131        } 
    115132    } 
    116133 
Note: See TracChangeset for help on using the changeset viewer.