[wp-trac] [WordPress Trac] #4492: Making wp_list_authors('show_fullname=1'); work when only first or last name entered

WordPress Trac wp-trac at lists.automattic.com
Tue Jun 19 18:35:52 GMT 2007


#4492: Making wp_list_authors('show_fullname=1'); work when only first or last
name entered
---------------------+------------------------------------------------------
 Reporter:  spiff06  |       Owner:  anonymous                    
     Type:  defect   |      Status:  new                          
 Priority:  normal   |   Milestone:  2.2.2                        
Component:  General  |     Version:  2.2.1                        
 Severity:  normal   |    Keywords:  show_fullname wp_list_authors
---------------------+------------------------------------------------------
 Spent a little time the other day 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 on the site I tested only have a first name,
 never a last name.  Yet the php function '''wp_list_authors()''' (in
 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.

 Thanks for the great work!

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4492>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list