Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#24680 closed defect (bug) (fixed)

wp_dropdown_users references user_login attribute that is never set

Reported by: sphoid's profile sphoid Owned by:
Milestone: 3.6 Priority: normal
Severity: minor Version: 3.5.2
Component: Users Keywords:
Focuses: Cc:


When wp_dropdown_users is called and the internal foreach loop encounters as user with an empty value for the attribute indicated in $show it attempts to fallback on $user->user_login to show as the option text. When the fallback happens a php notice is triggered "Undefined property: stdClass::$user_login". By default get_users() is called with 'fields' = array('ID', $show) and by default $show is set to display_name so user_login is never an attribute of the queried users unless $show is set to user_login by some chance. I am attaching a patch that adds user_login to the fields argument

Attachments (1)

user.php.diff (428 bytes) - added by sphoid 11 years ago.
Patch to add user_login to fields argument (wp-includes/user.php)

Download all attachments as: .zip

Change History (2)

11 years ago

Patch to add user_login to fields argument (wp-includes/user.php)

#1 @ocean90
10 years ago

  • Milestone changed from Awaiting Review to 3.6
  • Resolution set to fixed
  • Status changed from new to closed

Hello sphoid, thanks for your report and patch.

The bug is fixed in [24719].

Note: See TracTickets for help on using tickets.