Provide back compat mapping for user_level, wp_usersettings and wp_usersettingstime properties of WP_User objects. Fixes #19265.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
304a36041a
commit
27a55d6459
|
@ -420,11 +420,7 @@ class WP_User {
|
||||||
*/
|
*/
|
||||||
var $filter = null;
|
var $filter = null;
|
||||||
|
|
||||||
private static $back_compat_keys = array(
|
private static $back_compat_keys;
|
||||||
'user_firstname' => 'first_name',
|
|
||||||
'user_lastname' => 'last_name',
|
|
||||||
'user_description' => 'description'
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -440,6 +436,18 @@ class WP_User {
|
||||||
* @return WP_User
|
* @return WP_User
|
||||||
*/
|
*/
|
||||||
function __construct( $id = 0, $name = '', $blog_id = '' ) {
|
function __construct( $id = 0, $name = '', $blog_id = '' ) {
|
||||||
|
if ( ! isset( self::$back_compat_keys ) ) {
|
||||||
|
$prefix = $GLOBALS['wpdb']->prefix;
|
||||||
|
self::$back_compat_keys = array(
|
||||||
|
'user_firstname' => 'first_name',
|
||||||
|
'user_lastname' => 'last_name',
|
||||||
|
'user_description' => 'description',
|
||||||
|
'user_level' => $prefix . 'user_level',
|
||||||
|
$prefix . 'usersettings' => $prefix . 'user-settings',
|
||||||
|
$prefix . 'usersettingstime' => $prefix . 'user-settings-time',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! empty( $id ) && ! is_numeric( $id ) ) {
|
if ( ! empty( $id ) && ! is_numeric( $id ) ) {
|
||||||
$name = $id;
|
$name = $id;
|
||||||
$id = 0;
|
$id = 0;
|
||||||
|
|
Loading…
Reference in New Issue