WordPress.org

Make WordPress Core

Changeset 21876


Ignore:
Timestamp:
09/16/12 22:33:24 (19 months ago)
Author:
nacin
Message:

On user creation, default the display name to the first and last names provided. props mikelittle for the initial patch. fixes #20637.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/user.php

    r21794 r21876  
    13011301        return new WP_Error('existing_user_email', __('This email address is already registered.') ); 
    13021302 
    1303     if ( empty($display_name) ) 
    1304         $display_name = $user_login; 
    1305     $display_name = apply_filters('pre_user_display_name', $display_name); 
    1306  
    13071303    if ( empty($nickname) ) 
    13081304        $nickname = $user_login; 
     
    13161312        $last_name = ''; 
    13171313    $last_name = apply_filters('pre_user_last_name', $last_name); 
     1314 
     1315    if ( empty( $display_name ) ) { 
     1316        if ( $update ) 
     1317            $display_name = $user_login; 
     1318        elseif ( $first_name && $last_name ) 
     1319            /* translators: 1: first name, 2: last name */ 
     1320            $display_name = sprintf( _x( '%1$s %2$s', 'Display name based on first name and last name' ), $first_name, $last_name ); 
     1321        elseif ( $first_name ) 
     1322            $display_name = $first_name; 
     1323        elseif ( $last_name ) 
     1324            $display_name = $last_name; 
     1325        else 
     1326            $display_name = $user_login; 
     1327    } 
     1328    $display_name = apply_filters( 'pre_user_display_name', $display_name ); 
    13181329 
    13191330    if ( empty($description) ) 
Note: See TracChangeset for help on using the changeset viewer.