Ticket #20637: patch-20637.diff
File patch-20637.diff, 2.5 KB (added by , 13 years ago) |
---|
-
wp-includes/default-filters.php
191 191 add_filter( 'pings_open', '_close_comments_for_old_post', 10, 2 ); 192 192 add_filter( 'editable_slug', 'urldecode' ); 193 193 add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object' ); 194 add_filter( 'pre_user_display_name', '_wp_pre_user_display_name', 10, 2 ); 194 195 195 196 // Actions 196 197 add_action( 'wp_head', 'wp_enqueue_scripts', 1 ); -
wp-includes/user.php
1291 1291 if ( !$update && ! defined( 'WP_IMPORTING' ) && email_exists($user_email) ) 1292 1292 return new WP_Error('existing_user_email', __('This email address is already registered.') ); 1293 1293 1294 if ( empty($display_name) )1295 $display_name = $user_login;1296 $display_name = apply_filters('pre_user_display_name', $display_name);1297 1298 1294 if ( empty($nickname) ) 1299 1295 $nickname = $user_login; 1300 1296 $nickname = apply_filters('pre_user_nickname', $nickname); … … 1307 1303 $last_name = ''; 1308 1304 $last_name = apply_filters('pre_user_last_name', $last_name); 1309 1305 1306 if ( empty($display_name) ) 1307 $display_name = $user_login; 1308 $display_name = apply_filters('pre_user_display_name', $display_name, $userdata ); 1309 1310 1310 if ( empty($description) ) 1311 1311 $description = ''; 1312 1312 $description = apply_filters('pre_user_description', $description); … … 1489 1489 ); 1490 1490 return apply_filters( 'user_contactmethods', $user_contactmethods, $user ); 1491 1491 } 1492 1493 /** 1494 * Create the default display name from the first and last names, but only if 1495 * the field is currently empty. 1496 * 1497 * @access private 1498 * @since 3.4 1499 * 1500 * @param object $display_name String the current display_name value 1501 * @param object $userdata Array - The parameters originally passed to wp_insert_user() 1502 * @return array $display_name the constructed display name 1503 */ 1504 function _wp_pre_user_display_name( $display_name, $userdata = array() ) { 1505 if ( empty( $display_name ) ) { 1506 if ( !empty( $userdata ) && ( !empty( $userdata['first_name'] ) || !empty( $userdata['last_name'] ) ) ) { 1507 return sprintf( _x( '%1$s %2$s', 'Construct user display name from first name and second name' ), $userdata['first_name'], $userdata['last_name'] ); 1508 } 1509 } 1510 return $display_name; 1511 } 1512 No newline at end of file