Skip to content

Commit 71a56d8

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@60174 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e800c60 commit 71a56d8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/wp-includes/class-wp-user.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class WP_User {
125125
* @param string $name Optional. User's username
126126
* @param int $site_id Optional Site ID, defaults to current site.
127127
*/
128-
public function __construct( $id = 0, $name = '', $site_id = '' ) {
128+
public function __construct( $id = 0, $name = '', $site_id = 0 ) {
129129
global $wpdb;
130130

131131
if ( ! isset( self::$back_compat_keys ) ) {
@@ -175,7 +175,7 @@ public function __construct( $id = 0, $name = '', $site_id = '' ) {
175175
* @param object $data User DB row object.
176176
* @param int $site_id Optional. The site ID to initialize for.
177177
*/
178-
public function init( $data, $site_id = '' ) {
178+
public function init( $data, $site_id = 0 ) {
179179
if ( ! isset( $data->ID ) ) {
180180
$data->ID = 0;
181181
}
@@ -852,7 +852,7 @@ public function translate_level_to_cap( $level ) {
852852
*
853853
* @param int $blog_id Optional. Site ID, defaults to current site.
854854
*/
855-
public function for_blog( $blog_id = '' ) {
855+
public function for_blog( $blog_id = 0 ) {
856856
_deprecated_function( __METHOD__, '4.9.0', 'WP_User::for_site()' );
857857

858858
$this->for_site( $blog_id );
@@ -867,7 +867,7 @@ public function for_blog( $blog_id = '' ) {
867867
*
868868
* @param int $site_id Site ID to initialize user capabilities for. Default is the current site.
869869
*/
870-
public function for_site( $site_id = '' ) {
870+
public function for_site( $site_id = 0 ) {
871871
global $wpdb;
872872

873873
if ( ! empty( $site_id ) ) {

0 commit comments

Comments
 (0)