WordPress.org

Ready to get started?Download WordPress

Forums

function _init_caps() (1 post)

  1. Kreisquadratur
    Member
    Posted 7 years ago #

    A really short question as I searched the forum for similar topics and didn't get the right answer:

    Why is the database field "capabilities" in $prefix."usermeta" connected to the database tables' prefix?

    That doesn't make any sense to me, as I got a problem just yesterday: After changing the tables' name from wp_* into v4_wp_* I didn't have any (admin) rights anymore. Why? Because the field "capabilities" was fix connected to the last tables' prefix name. So everybody changing the tables' prefix name after an installation should run into the same trouble.

    So, If none's against it, I would prefer to change those lines:

    167		function _init_caps() {
    168			global $wpdb;
    169	-		$this->cap_key = $wpdb->prefix . 'capabilities';
    	+		$this->cap_key = 'capabilities';
    170			$this->caps = &$this->{$this->cap_key};
    171			if ( ! is_array($this->caps) )
    172				$this->caps = array();
    172			$this->get_role_caps();
    173		}

    ...same as for the old "user_level"(?).

Topic Closed

This topic has been closed to new replies.

About this Topic