WordPress.org

Make WordPress Core

Opened 10 months ago

Closed 8 weeks ago

#24680 closed defect (bug) (fixed)

wp_dropdown_users references user_login attribute that is never set

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

Description

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 10 months ago.
Patch to add user_login to fields argument (wp-includes/user.php)

Download all attachments as: .zip

Change History (2)

sphoid10 months ago

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

comment:1 ocean908 weeks 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.