Do not clear the old values in "Display name publicly as" drop-down on the user profile screen, append new values there when the user changes any of20747 the name fields, fixes #20747

git-svn-id: http://core.svn.wordpress.org/trunk@20964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2012-05-30 21:54:33 +00:00
parent 1d9c8f9aed
commit 9855eccd45
2 changed files with 7 additions and 6 deletions

View File

@ -41,7 +41,7 @@
if ( select.length ) { if ( select.length ) {
$('#first_name, #last_name, #nickname').bind( 'blur.user_profile', function() { $('#first_name, #last_name, #nickname').bind( 'blur.user_profile', function() {
var current = select.find('option:selected').attr('id'), dub = [], var dub = [],
inputs = { inputs = {
display_nickname : $('#nickname').val() || '', display_nickname : $('#nickname').val() || '',
display_username : $('#user_login').val() || '', display_username : $('#user_login').val() || '',
@ -54,7 +54,10 @@
inputs['display_lastfirst'] = inputs.display_lastname + ' ' + inputs.display_firstname; inputs['display_lastfirst'] = inputs.display_lastname + ' ' + inputs.display_firstname;
} }
$('option', select).remove(); $.each( $('option', select), function( i, el ){
dub.push( el.value );
});
$.each(inputs, function( id, value ) { $.each(inputs, function( id, value ) {
if ( ! value ) if ( ! value )
return; return;
@ -64,9 +67,7 @@
if ( inputs[id].length && $.inArray( val, dub ) == -1 ) { if ( inputs[id].length && $.inArray( val, dub ) == -1 ) {
dub.push(val); dub.push(val);
$('<option />', { $('<option />', {
'id': id, 'text': val
'text': val,
'selected': (id == current)
}).appendTo( select ); }).appendTo( select );
} }
}); });

View File

@ -319,7 +319,7 @@ if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_c
foreach ( $public_display as $id => $item ) { foreach ( $public_display as $id => $item ) {
?> ?>
<option id="<?php echo $id; ?>"<?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option> <option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
<?php <?php
} }
?> ?>