wip
This commit is contained in:
@@ -125,7 +125,7 @@ class WP_User {
|
||||
* @param string $name Optional. User's username
|
||||
* @param int $site_id Optional Site ID, defaults to current site.
|
||||
*/
|
||||
public function __construct( $id = 0, $name = '', $site_id = '' ) {
|
||||
public function __construct( $id = 0, $name = '', $site_id = 0 ) {
|
||||
global $wpdb;
|
||||
|
||||
if ( ! isset( self::$back_compat_keys ) ) {
|
||||
@@ -175,7 +175,7 @@ class WP_User {
|
||||
* @param object $data User DB row object.
|
||||
* @param int $site_id Optional. The site ID to initialize for.
|
||||
*/
|
||||
public function init( $data, $site_id = '' ) {
|
||||
public function init( $data, $site_id = 0 ) {
|
||||
if ( ! isset( $data->ID ) ) {
|
||||
$data->ID = 0;
|
||||
}
|
||||
@@ -515,9 +515,15 @@ class WP_User {
|
||||
|
||||
$wp_roles = wp_roles();
|
||||
|
||||
// Filter out caps that are not role names and assign to $this->roles.
|
||||
// Select caps that are 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' ) );
|
||||
$this->roles = array();
|
||||
|
||||
foreach ( $this->caps as $key => $value ) {
|
||||
if ( $wp_roles->is_role( $key ) ) {
|
||||
$this->roles[] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build $allcaps from role caps, overlay user's $caps.
|
||||
@@ -852,7 +858,7 @@ class WP_User {
|
||||
*
|
||||
* @param int $blog_id Optional. Site ID, defaults to current site.
|
||||
*/
|
||||
public function for_blog( $blog_id = '' ) {
|
||||
public function for_blog( $blog_id = 0 ) {
|
||||
_deprecated_function( __METHOD__, '4.9.0', 'WP_User::for_site()' );
|
||||
|
||||
$this->for_site( $blog_id );
|
||||
@@ -867,7 +873,7 @@ class WP_User {
|
||||
*
|
||||
* @param int $site_id Site ID to initialize user capabilities for. Default is the current site.
|
||||
*/
|
||||
public function for_site( $site_id = '' ) {
|
||||
public function for_site( $site_id = 0 ) {
|
||||
global $wpdb;
|
||||
|
||||
if ( ! empty( $site_id ) ) {
|
||||
|
||||
Reference in New Issue
Block a user