Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#33869 closed defect (bug) (fixed)

get_user_by() should accept ID as a field

Reported by: Shelob9 Owned by: boonebgorges
Priority: normal Milestone: 4.4
Component: General Version: 4.4
Severity: normal Keywords:
Cc: Focuses:

Description

get_user_by() and WP_User::get_data_by() which it calls accept id but not ID as a value for the $field argument. This is counter-intuitive, since the DB column is "ID" not "id". I am attaching a patch to allow passing "ID", without breaking the use of "id".

Attachments (1)

33869.diff​ (897 bytes ) - added by Shelob9 11 years ago.

Download all attachments as: .zip

Change History (5)

#1 @sc0ttkclark
11 years ago

+1 for consistency

#2 @boonebgorges
11 years ago

  • Milestone Awaiting Review → 4.4

Thanks for the patch. I'll write a unit test and clean up the documentation.

#3 @boonebgorges
11 years ago

  • Owner set to boonebgorges
  • Resolution → fixed
  • Status new → closed

In 34125:

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.

This ticket was mentioned in ​Slack in #buddypress by djpaul. ​View the logs.


11 years ago

Note: See TracTickets for help on using tickets.