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: https://develop.svn.wordpress.org/trunk@3668 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-03-30 23:35:42 +00:00
parent 657b7d8176
commit 3f23e768fe
1 changed files with 11 additions and 0 deletions

View File

@ -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) )