Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#15888 closed defect (bug) (fixed)

show_fullname argument in wp_list_authors broken

Reported by: greenshady's profile greenshady Owned by:
Milestone: 3.1 Priority: highest omg bbq
Severity: normal Version: 3.1
Component: Template Keywords: has-patch
Focuses: Cc:

Description

The problem seems to come from the change in #10329 to make wp_list_authors() use the get_users() function. The show_fullname argument relies on the first_name and last_name user meta keys, which aren't a part of the user objects returned from the user query.

In the wp_list_authors() function in author-template.php, we're checking for $author->first_name and $author->last_name, which will never be true, so it always shows $author->display_name:

if ( $show_fullname && $author->first_name && $author->last_name )
	$name = "$author->first_name $author->last_name";
else
	$name = $author->display_name;

WP_DEBUG message:

Notice: Undefined property: stdClass::$first_name in C:\xampplite\htdocs\wp-includes\author-template.php on line 305

Attachments (1)

15888.diff (994 bytes) - added by scribu 14 years ago.

Download all attachments as: .zip

Change History (5)

#1 @nacin
14 years ago

  • Milestone changed from Awaiting Review to 3.1
  • Priority changed from normal to highest omg bbq

#2 @duck_
14 years ago

I believe this broke in [17013] and now wp_list_authors does not use 'all_with_meta' because it causes fatal errors if a lot of users will be returned by the query.

@scribu
14 years ago

#3 @scribu
14 years ago

  • Keywords has-patch added

15888.diff retrieves only the ids and then calls get_userdata(), just like in 3.0.

#4 @ryan
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [17100]) Retrieve only IDs and then do a user fetch loop so that all required user data is present. Props scribu. fixes #15888

Note: See TracTickets for help on using tickets.