Coding Standards: Correct $site_id parameter default values in WP_User.
This commit corrects the default `$site_id` parameter values used throughout the `WP_User` class to bring them in line with their `int` doctypes (and the doctypes of the functions used internally by the affected class methods). More specifically, * `__construct()`: `$site_id = ''` changed to `$site_id = 0` * `init()`: `$site_id = ''` changed to `$site_id = 0` * `for_blog()`: `$blog_id = ''` changed to `$blog_id = 0` * `for_site()`: `$site_id = ''` changed to `$site_id = 0` Follow-up to [12796], [15566], [18597], [41624]. Props justlevine. See #63268. Built from https://develop.svn.wordpress.org/trunk@60174 git-svn-id: http://core.svn.wordpress.org/trunk@59510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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;
|
||||
}
|
||||
@@ -852,7 +852,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 +867,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 ) ) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.9-alpha-60173';
|
||||
$wp_version = '6.9-alpha-60174';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user