Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#33869 closed defect (bug) (fixed)

get_user_by() should accept ID as a field

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

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 9 years ago.

Download all attachments as: .zip

Change History (5)

@Shelob9
9 years ago

#1 @sc0ttkclark
9 years ago

+1 for consistency

#2 @boonebgorges
9 years ago

  • Milestone changed from Awaiting Review to 4.4

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

#3 @boonebgorges
9 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to 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.


9 years ago

Note: See TracTickets for help on using tickets.