Changeset 937854
- Timestamp:
- 06/24/2014 01:48:00 PM (12 years ago)
- Location:
- mg-quotes/trunk
- Files:
-
- 1 added
- 7 edited
-
includes/admin/list-table.php (modified) (1 diff)
-
includes/admin/meta-box.php (modified) (1 diff)
-
includes/class-mg-qt-installer.php (added)
-
includes/cpt.php (modified) (1 diff)
-
includes/tax.php (modified) (2 diffs)
-
plugin.php (modified) (2 diffs)
-
readme.txt (modified) (4 diffs)
-
uninstall.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mg-quotes/trunk/includes/admin/list-table.php
r911689 r937854 24 24 'cb' => '<input type="checkbox">', 25 25 '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') 28 29 ); 29 30 -
mg-quotes/trunk/includes/admin/meta-box.php
r909686 r937854 35 35 array($this, 'render_title_meta_box'), 36 36 null, 37 ' advanced',38 ' default'37 'normal', 38 'high' 39 39 ); 40 40 } -
mg-quotes/trunk/includes/cpt.php
r909686 r937854 26 26 'hierarchical' => false, 27 27 'public' => true, 28 //'menu_position' => null,29 28 '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'), 34 32 'register_meta_box_cb' => null, 35 33 'taxonomies' => array(), -
mg-quotes/trunk/includes/tax.php
r909686 r937854 15 15 'show_tagcloud' => true, 16 16 '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 ), 18 23 'rewrite' => array('slug' => __('Category', 'mg_qt')), 19 24 'query_var' => 'mg_qt_category', … … 48 53 'show_tagcloud' => true, 49 54 '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 ), 51 61 'rewrite' => array('slug' => __('Author', 'mg_qt')), 52 62 'query_var' => 'mg_qt_author', -
mg-quotes/trunk/plugin.php
r911689 r937854 12 12 if (!defined('ABSPATH')) exit; 13 13 14 define('MG_QT_PLUGIN_FILE', __FILE__); 14 15 define('MG_QT_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__)); 15 16 define('MG_QT_INCLUDES', MG_QT_PLUGIN_DIR_PATH . 'includes/'); … … 17 18 define('MG_QT_ASSETS', MG_QT_PLUGIN_DIR_URL . 'assets/'); 18 19 20 require_once MG_QT_INCLUDES . 'class-mg-qt-installer.php'; 19 21 require_once MG_QT_INCLUDES . 'cpt.php'; 20 22 require_once MG_QT_INCLUDES . 'tax.php'; -
mg-quotes/trunk/readme.txt
r911689 r937854 4 4 Tags: quotes, random quotes 5 5 Requires at least: 3.1 6 Tested up to: 3.9 6 Tested up to: 3.9.1 7 7 Stable tag: trunk 8 8 License: GPLv2 or later … … 25 25 * Import/Export of quotes between WordPress installations 26 26 * 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 27 28 * Cleanup on uninstall 28 29 … … 40 41 From the Quotes/All quotes page there is the standard post list table WP user interface to browse through the quotes. 41 42 There 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 46 The plugin define and assign at installation time the following primitive capabilities to the 'administrator' role: 47 48 Category custom taxonomy: 49 50 * 'manage_quote_categories' 51 * 'edit_quote_categories' 52 * 'delete_quote_categories' 53 * 'assign_quote_categories' 54 55 Author custom taxonomy: 56 57 * 'manage_quote_authors' 58 * 'edit_quote_authors' 59 * 'delete_quote_authors' 60 * 'assign_quote_authors' 61 62 Quote 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 76 Their names should be self-explanatory. 77 78 To 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/). 42 79 43 80 *Import/Export* … … 136 173 = 1.0.2 = 137 174 * 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 6 6 $this->delete_quotes(); 7 7 $this->delete_taxonomies(); 8 $this->remove_caps(); 8 9 } 9 10 … … 30 31 } 31 32 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 32 40 private function get_terms($tax_name) { 33 41 global $wpdb; … … 41 49 return $wpdb->get_results($query); 42 50 } 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 } 43 78 44 79 }
Note: See TracChangeset
for help on using the changeset viewer.