mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Accept 'ID' as a valid $field in get_user_by().
We already accept 'id'. `ID` more closely matches the database and `WP_User` schemas. Props Shelob9. Fixes #33869. git-svn-id: https://develop.svn.wordpress.org/trunk@34125 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -165,18 +165,24 @@ class WP_User {
|
||||
* Return only the main user fields
|
||||
*
|
||||
* @since 3.3.0
|
||||
* @since 4.4.0 Added 'ID' as an alias of 'id' for the `$field` parameter.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @global wpdb $wpdb
|
||||
*
|
||||
* @param string $field The field to query against: 'id', 'slug', 'email' or 'login'
|
||||
* @param string $field The field to query against: 'id', 'ID', 'slug', 'email' or 'login'.
|
||||
* @param string|int $value The field value
|
||||
* @return object|false Raw user object
|
||||
*/
|
||||
public static function get_data_by( $field, $value ) {
|
||||
global $wpdb;
|
||||
|
||||
// 'ID' is an alias of 'id'.
|
||||
if ( 'ID' === $field ) {
|
||||
$field = 'id';
|
||||
}
|
||||
|
||||
if ( 'id' == $field ) {
|
||||
// Make sure the value is numeric to avoid casting objects, for example,
|
||||
// to int 1.
|
||||
|
||||
Reference in New Issue
Block a user