Changeset 34125
- Timestamp:
- 09/14/2015 06:57:15 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-user.php
r33967 r34125 166 166 * 167 167 * @since 3.3.0 168 * @since 4.4.0 Added 'ID' as an alias of 'id' for the `$field` parameter. 168 169 * 169 170 * @static … … 171 172 * @global wpdb $wpdb 172 173 * 173 * @param string $field The field to query against: 'id', ' slug', 'email' or 'login'174 * @param string $field The field to query against: 'id', 'ID', 'slug', 'email' or 'login'. 174 175 * @param string|int $value The field value 175 176 * @return object|false Raw user object … … 177 178 public static function get_data_by( $field, $value ) { 178 179 global $wpdb; 180 181 // 'ID' is an alias of 'id'. 182 if ( 'ID' === $field ) { 183 $field = 'id'; 184 } 179 185 180 186 if ( 'id' == $field ) { -
trunk/src/wp-includes/pluggable.php
r34116 r34125 146 146 * 147 147 * @since 2.8.0 148 * 149 * @param string $field The field to retrieve the user with. id | slug | email | login 148 * @since 4.4.0 Added 'ID' as an alias of 'id' for the `$field` parameter. 149 * 150 * @param string $field The field to retrieve the user with. id | ID | slug | email | login. 150 151 * @param int|string $value A value for $field. A user ID, slug, email address, or login name. 151 152 * @return WP_User|false WP_User object on success, false on failure. -
trunk/tests/phpunit/tests/user.php
r34116 r34125 444 444 $user = WP_User::get_data_by( 'id', 99999 ); 445 445 $this->assertEquals( false, $user ); 446 } 447 448 /** 449 * @ticket 33869 450 */ 451 public function test_user_get_data_by_ID_should_alias_to_id() { 452 $u = $this->factory->user->create(); 453 454 $user = WP_User::get_data_by( 'ID', $u ); 455 $this->assertEquals( $u, $user->ID ); 446 456 } 447 457
Note: See TracChangeset
for help on using the changeset viewer.