summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-includes/capabilities.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-01-20 17:03:17 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-01-20 17:03:17 +0000
commitde23735d75bd523cea68e43fc1ef717eb440d069 (patch)
tree324aec89bd3e3ed45a3976d526b6abd50bb5d230 /wp-inst/wp-includes/capabilities.php
parent42ad115c5b6e5d184a54f825a5c24b19a3b30fb3 (diff)
WP Merge
Removed Legacy Code (Thanks IT Damager) createBlog - only backup roles class if it exists! git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@507 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/capabilities.php')
-rw-r--r--wp-inst/wp-includes/capabilities.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/wp-inst/wp-includes/capabilities.php b/wp-inst/wp-includes/capabilities.php
index d6877d3..e148974 100644
--- a/wp-inst/wp-includes/capabilities.php
+++ b/wp-inst/wp-includes/capabilities.php
@@ -85,6 +85,9 @@ class WP_Role {
function add_cap($cap, $grant = true) {
global $wp_roles;
+ if ( ! isset($wp_roles) )
+ $wp_roles = new WP_Roles();
+
$this->capabilities[$cap] = $grant;
$wp_roles->add_cap($this->name, $cap, $grant);
}
@@ -92,6 +95,9 @@ class WP_Role {
function remove_cap($cap) {
global $wp_roles;
+ if ( ! isset($wp_roles) )
+ $wp_roles = new WP_Roles();
+
unset($this->capabilities[$cap]);
$wp_roles->remove_cap($this->name, $cap);
}
@@ -115,7 +121,7 @@ class WP_User {
var $allcaps = array();
function WP_User($id, $name = '') {
- global $wp_roles, $table_prefix;
+ global $table_prefix;
if ( empty($id) && empty($name) )
return;
@@ -147,6 +153,10 @@ class WP_User {
function get_role_caps() {
global $wp_roles;
+
+ if ( ! isset($wp_roles) )
+ $wp_roles = new WP_Roles();
+
//Filter out caps that are not role names and assign to $this->roles
if(is_array($this->caps))
$this->roles = array_filter(array_keys($this->caps), array(&$wp_roles, 'is_role'));
@@ -214,8 +224,6 @@ class WP_User {
//has_cap(capability_or_role_name) or
//has_cap('edit_post', post_id)
function has_cap($cap) {
- global $wp_roles;
-
if ( is_numeric($cap) )
$cap = $this->translate_level_to_cap($cap);
@@ -316,18 +324,27 @@ function current_user_can($capability) {
function get_role($role) {
global $wp_roles;
+ if ( ! isset($wp_roles) )
+ $wp_roles = new WP_Roles();
+
return $wp_roles->get_role($role);
}
function add_role($role, $display_name, $capabilities = '') {
global $wp_roles;
+ if ( ! isset($wp_roles) )
+ $wp_roles = new WP_Roles();
+
return $wp_roles->add_role($role, $display_name, $capabilities = '');
}
function remove_role($role) {
global $wp_roles;
+ if ( ! isset($wp_roles) )
+ $wp_roles = new WP_Roles();
+
return $wp_roles->remove_role($role);
}