Plugin Directory

Changeset 937854


Ignore:
Timestamp:
06/24/2014 01:48:00 PM (12 years ago)
Author:
giuliom
Message:

v1.1

Location:
mg-quotes/trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • mg-quotes/trunk/includes/admin/list-table.php

    r911689 r937854  
    2424            'cb' => '<input type="checkbox">',
    2525            'title' => __('Title', 'mg_qt'),
    26             'taxonomy-mg_qt_author' => __('Author', 'mg_qt'),
    27             'taxonomy-mg_qt_category' => __('Category', 'mg_qt')
     26            'taxonomy-mg_qt_author' => __('Quote Author', 'mg_qt'),
     27            'taxonomy-mg_qt_category' => __('Category', 'mg_qt'),
     28            'author' => __('Author', 'mg_qt')
    2829        );
    2930       
  • mg-quotes/trunk/includes/admin/meta-box.php

    r909686 r937854  
    3535            array($this, 'render_title_meta_box'),
    3636            null,
    37             'advanced',
    38             'default'
     37            'normal',
     38            'high'
    3939        );
    4040    }
  • mg-quotes/trunk/includes/cpt.php

    r909686 r937854  
    2626        'hierarchical'         => false,
    2727        'public'               => true,
    28         //'menu_position'        => null,
    2928        'menu_icon'            => 'dashicons-format-quote',
    30         'capability_type'      => 'post',
    31         'capabilities'         => array(),
    32         'map_meta_cap'         => null,
    33         'supports'             => array('custom-fields'),
     29        'capability_type'      => 'quote',
     30        'map_meta_cap'         => true,
     31        'supports'             => array('custom-fields', 'author'),
    3432        'register_meta_box_cb' => null,
    3533        'taxonomies'           => array(),
  • mg-quotes/trunk/includes/tax.php

    r909686 r937854  
    1515        'show_tagcloud'         => true,
    1616        'meta_box_cb'           => null,
    17         'capabilities'          => array(),
     17        'capabilities'          => array(
     18            'manage_terms' => 'manage_quote_categories',
     19            'edit_terms'   => 'edit_quote_categories',
     20            'delete_terms' => 'delete_quote_categories',
     21            'assign_terms' => 'assign_quote_categories'
     22        ),
    1823        'rewrite' => array('slug' => __('Category', 'mg_qt')),
    1924        'query_var'             => 'mg_qt_category',
     
    4853        'show_tagcloud'         => true,
    4954        'meta_box_cb'           => false,
    50         'capabilities'          => array(),
     55        'capabilities'          => array(
     56            'manage_terms' => 'manage_quote_authors',
     57            'edit_terms'   => 'edit_quote_authors',
     58            'delete_terms' => 'delete_quote_authors',
     59            'assign_terms' => 'assign_quote_authors'
     60        ),
    5161        'rewrite' => array('slug' => __('Author', 'mg_qt')),
    5262        'query_var'             => 'mg_qt_author',
  • mg-quotes/trunk/plugin.php

    r911689 r937854  
    1212if (!defined('ABSPATH')) exit;
    1313
     14define('MG_QT_PLUGIN_FILE', __FILE__);
    1415define('MG_QT_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__));
    1516define('MG_QT_INCLUDES', MG_QT_PLUGIN_DIR_PATH . 'includes/');
     
    1718define('MG_QT_ASSETS', MG_QT_PLUGIN_DIR_URL . 'assets/');
    1819
     20require_once MG_QT_INCLUDES . 'class-mg-qt-installer.php';
    1921require_once MG_QT_INCLUDES . 'cpt.php';
    2022require_once MG_QT_INCLUDES . 'tax.php';
  • mg-quotes/trunk/readme.txt

    r911689 r937854  
    44Tags: quotes, random quotes
    55Requires at least: 3.1
    6 Tested up to: 3.9
     6Tested up to: 3.9.1
    77Stable tag: trunk
    88License: GPLv2 or later
     
    2525* Import/Export of quotes between WordPress installations
    2626* Publish quotes on the front end with widgets, shortcodes and template tags
     27* Restrict or allow access to the quotes and the relative operations in admin with fine grained access control
    2728* Cleanup on uninstall
    2829
     
    4041From the Quotes/All quotes page there is the standard post list table WP user interface to browse through the quotes.
    4142There is the full text search and two filters for the author and/or the category.
     43
     44*Restrict or allow access to the quotes and the relative operations in admin with fine grained access control*
     45
     46The plugin define and assign at installation time the following primitive capabilities to the 'administrator' role:
     47
     48Category custom taxonomy:
     49
     50* 'manage_quote_categories'
     51* 'edit_quote_categories'
     52* 'delete_quote_categories'
     53* 'assign_quote_categories'
     54
     55Author custom taxonomy:
     56
     57* 'manage_quote_authors'
     58* 'edit_quote_authors'
     59* 'delete_quote_authors'
     60* 'assign_quote_authors'
     61
     62Quote custom post type:
     63
     64* 'edit_quotes'
     65* 'edit_others_quotes'
     66* 'publish_quotes'
     67* 'read_private_quotes'
     68* 'read'
     69* 'delete_quotes'
     70* 'delete_private_quotes'
     71* 'delete_published_quotes'
     72* 'delete_others_quotes'
     73* 'edit_private_quotes'
     74* 'edit_published_quotes'
     75
     76Their names should be self-explanatory.
     77
     78To customize the access control it is sufficient to grant/revoke such caps with a role editing plugin, for example [User Role Editor](http://wordpress.org/plugins/user-role-editor/).
    4279
    4380*Import/Export*
     
    136173= 1.0.2 =
    137174* Fix: display post ID only on quote CPT list table
     175
     176= 1.1 =
     177* Feature: Fine grained access control in admin
     178* Feature: Support of quote post author(the WP user that entered the quote)
  • mg-quotes/trunk/uninstall.php

    r909686 r937854  
    66        $this->delete_quotes();
    77        $this->delete_taxonomies();
     8        $this->remove_caps();
    89    }
    910   
     
    3031    }
    3132   
     33    private function remove_caps() {
     34        $admin_role = get_role('administrator');
     35       
     36        foreach ($this->get_caps() as $cap)
     37            $admin_role->remove_cap($cap);
     38    }
     39   
    3240    private function get_terms($tax_name) {
    3341        global $wpdb;
     
    4149        return $wpdb->get_results($query);
    4250    }
     51   
     52    private function get_caps() {
     53        return array(
     54            // Category custom taxonomy
     55            'manage_quote_categories',
     56            'edit_quote_categories',
     57            'delete_quote_categories',
     58            'assign_quote_categories',
     59            // Author custom taxonomy
     60            'manage_quote_authors',
     61            'edit_quote_authors',
     62            'delete_quote_authors',
     63            'assign_quote_authors',
     64            // CPT
     65            'edit_quotes',
     66            'edit_others_quotes',
     67            'publish_quotes',
     68            'read_private_quotes',
     69            'read',
     70            'delete_quotes',
     71            'delete_private_quotes',
     72            'delete_published_quotes',
     73            'delete_others_quotes',
     74            'edit_private_quotes',
     75            'edit_published_quotes'
     76        );
     77    }
    4378
    4479}
Note: See TracChangeset for help on using the changeset viewer.