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: https://develop.svn.wordpress.org/trunk@20964 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2012-05-30 21:54:33 +00:00
parent 24df08ed87
commit ba848978ac
2 changed files with 7 additions and 6 deletions

View File

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