Making wp_list_authors(show_fullname=1'); work when only first name entered (3 posts)

  1. spiff06
    Posted 9 years ago #

    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?

  2. MichaelH
    Posted 9 years ago #

    Maybe something you should report to http://trac.wordpress.org

    Use your forum login/password to login there.

    See Reporting Bugs

  3. spiff06
    Posted 9 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic