From c07e1c444206fb3631471fafc48b6c158626b171 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 15 Dec 2023 12:37:29 +0000 Subject: [PATCH] Docs: Document the `$wpdb` global in `WP_User::__construct()`. Follow-up to [19325]. Props upadalavipul. See #60021. Built from https://develop.svn.wordpress.org/trunk@57190 git-svn-id: http://core.svn.wordpress.org/trunk@56701 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-user.php | 7 ++++++- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-user.php b/wp-includes/class-wp-user.php index aa759804c8..a3e40df164 100644 --- a/wp-includes/class-wp-user.php +++ b/wp-includes/class-wp-user.php @@ -117,13 +117,18 @@ class WP_User { * * @since 2.0.0 * + * @global wpdb $wpdb WordPress database abstraction object. + * * @param int|string|stdClass|WP_User $id User's ID, a WP_User object, or a user object from the DB. * @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 = '' ) { + global $wpdb; + if ( ! isset( self::$back_compat_keys ) ) { - $prefix = $GLOBALS['wpdb']->prefix; + $prefix = $wpdb->prefix; + self::$back_compat_keys = array( 'user_firstname' => 'first_name', 'user_lastname' => 'last_name', diff --git a/wp-includes/version.php b/wp-includes/version.php index 2a49c80154..649c9e16e8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-alpha-57189'; +$wp_version = '6.5-alpha-57190'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.