WordPress.org

Making WordPress.org

Changeset 12


Ignore:
Timestamp:
05/25/2013 10:39:47 PM (8 years ago)
Author:
nacin
Message:

Handbook plugin: make sure full editors can do things like delete handbook pages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/handbook.php

    r10 r12  
    2222    }
    2323
     24    static function editor_caps() {
     25        return array(
     26            'delete_handbook_pages', 'delete_others_handbook_pages',
     27            'delete_published_handbook_pages', 'delete_private_handbook_pages',
     28            'edit_private_handbook_pages', 'read_private_handbook_pages',
     29        );
     30    }
     31
    2432    function __construct() {
    2533        add_filter( 'user_has_cap', array( $this, 'grant_handbook_caps' ) );
     
    3745        foreach ( self::caps() as $cap ) {
    3846            $caps[ $cap ] = true;
     47        }
     48        if ( current_user_can( 'edit_pages' ) ) {
     49            foreach ( self::editor_caps() as $cap ) {
     50                $caps[ $cap ] = true;
     51            }
    3952        }
    4053        return $caps;
Note: See TracChangeset for help on using the changeset viewer.