/** * Retrieve all of the role capabilities and merge with individual capabilities. * * All of the capabilities of the roles the user belongs to are merged with * the users individual roles. This also means that the user can be denied * specific roles that their role might have, but the specific user isn't * granted permission to. * * @since 2.0.0 * @uses $wp_roles * @access public */ function get_role_caps() { global $wp_roles, $wp_users_object; if (!isset($wp_roles)) { $wp_roles = new BP_Roles($wp_users_object->db); } //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')); } //Build $allcaps from role caps, overlay user's $caps $this->allcaps = array(); foreach ((array) $this->roles as $role) { $role = $wp_roles->get_role($role); $this->allcaps = array_merge((array) $this->allcaps, (array) $role->capabilities); } $this->allcaps = array_merge((array) $this->allcaps, (array) $this->caps); }