mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 19:46:21 +00:00
Move DB prefix dependent code to separate init routines that can be called independently when the prefix changes. These methods are for internal use only.
git-svn-id: http://svn.automattic.com/wordpress/trunk@3668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
169842a7ce
commit
9046cdf77b
@ -8,6 +8,10 @@ class WP_Roles {
|
||||
var $role_key;
|
||||
|
||||
function WP_Roles() {
|
||||
$this->_init();
|
||||
}
|
||||
|
||||
function _init () {
|
||||
global $wpdb;
|
||||
$this->role_key = $wpdb->prefix . 'user_roles';
|
||||
|
||||
@ -16,6 +20,8 @@ class WP_Roles {
|
||||
if ( empty($this->roles) )
|
||||
return;
|
||||
|
||||
$this->role_objects = array();
|
||||
$this->role_names = array();
|
||||
foreach ($this->roles as $role => $data) {
|
||||
$this->role_objects[$role] = new WP_Role($role, $this->roles[$role]['capabilities']);
|
||||
$this->role_names[$role] = $this->roles[$role]['name'];
|
||||
@ -144,6 +150,11 @@ class WP_User {
|
||||
}
|
||||
|
||||
$this->id = $this->ID;
|
||||
$this->_init_caps();
|
||||
}
|
||||
|
||||
function _init_caps() {
|
||||
global $wpdb;
|
||||
$this->cap_key = $wpdb->prefix . 'capabilities';
|
||||
$this->caps = &$this->{$this->cap_key};
|
||||
if ( ! is_array($this->caps) )
|
||||
|
Loading…
x
Reference in New Issue
Block a user