From 298ca96c1af261f4987ce79f5f40e0b8a95684e1 Mon Sep 17 00:00:00 2001 From: Michael Nelson Date: Thu, 20 Jun 2013 23:49:35 -0700 Subject: [PATCH] capabilities for custom post types get added by default. in order for admins to have access, however, to these capabilities, admins need to be able to edit admin roles within this plugin, so I define URE_SHOW_ADMIN_ROLE. Having admins able to edit admin caps makes sense, especially because we are hiding the capability which allows them to view this page anyways. Therefore, using this plugin, an admin can never remove their ability to administrate roles, so its perfectly safe for them to edit admin roles, I think --- user-role-editor/includes/ure-options.php | 18 ++++++++++++++++++ user-role-editor/user-role-editor.php | 1 + 2 files changed, 19 insertions(+) diff --git a/user-role-editor/includes/ure-options.php b/user-role-editor/includes/ure-options.php index 5df8a9f..1be304d 100644 --- a/user-role-editor/includes/ure-options.php +++ b/user-role-editor/includes/ure-options.php @@ -103,6 +103,24 @@ } } } + +//add caps from custom post types +foreach(get_post_types(array('_builtin'=>false),'objects') as $key=>$object){ + //1 + //echo "post type key:$key";var_dump($object->cap); + foreach($object->cap as $capability){ + $cap['inner']=$capability; + $cap['human']= __(ure_ConvertCapsToReadable($capability),'ure'); + if ( isset( $built_in_wp_caps[ $key ] ) ) { + $cap['wp_core'] = true; + } else { + $cap['wp_core'] = false; + } + $ure_fullCapabilities[$capability] = $cap; + //echo "adding $capability";var_dump($cap); + } + +} asort($ure_fullCapabilities); diff --git a/user-role-editor/user-role-editor.php b/user-role-editor/user-role-editor.php index 71a1d72..a4a2558 100644 --- a/user-role-editor/user-role-editor.php +++ b/user-role-editor/user-role-editor.php @@ -51,6 +51,7 @@ define('URE_SPACE_REPLACER', '_URE-SR_'); define('URE_PARENT', 'users.php'); define('URE_KEY_CAPABILITY', 'administrator'); +define('URE_SHOW_ADMIN_ROLE',true); require_once('includes/ure-lib.php');