Support » Requests and Feedback » Making wp_list_authors(show_fullname=1′); work when only first name entered

  • Hello, and great work all!

    Spent a little time today trying to figure out why the full name wasn’t displaying in the sidebar when pasting in the default code.

    It turns out that all users only have a first name, never a last name, yet the php function (author-template.php) expects both fields to be present to display the full name:

    if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )
    	$name = "$author->first_name $author->last_name";

    I think changing the above code to the following might make sense:

    if ( $show_fullname && ($author->first_name != '' || $author->last_name != '') )
    	$name = trim("$author->first_name $author->last_name");

    This way, the actual name will be displayed as long as there’s either a first name or a last name defined.

    Comments? Was there a specific design reason why both first and last names were required?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Making wp_list_authors(show_fullname=1′); work when only first name entered’ is closed to new replies.