Don't try to append "Display Name" options when on the Add New User screen (the <select> doesn't exist there), props pbiron, SergeyBiryukov, fixes #20392
git-svn-id: http://svn.automattic.com/wordpress/trunk@20407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a312778602
commit
04f6979a13
|
@ -35,13 +35,19 @@
|
||||||
$('#pass-strength-result').show();
|
$('#pass-strength-result').show();
|
||||||
$('.color-palette').click(function(){$(this).siblings('input[name="admin_color"]').prop('checked', true)});
|
$('.color-palette').click(function(){$(this).siblings('input[name="admin_color"]').prop('checked', true)});
|
||||||
$('#first_name, #last_name, #nickname').blur(function(){
|
$('#first_name, #last_name, #nickname').blur(function(){
|
||||||
var select = $('#display_name'), current = select.find('option:selected').attr('id'), dub = [],
|
var select = $('#display_name'), current, dub = [], inputs;
|
||||||
inputs = {
|
|
||||||
display_nickname : $('#nickname').val(),
|
if ( !select.length )
|
||||||
display_username : $('#user_login').val(),
|
return;
|
||||||
display_firstname : $('#first_name').val(),
|
|
||||||
display_lastname : $('#last_name').val()
|
current = select.find('option:selected').attr('id');
|
||||||
};
|
|
||||||
|
inputs = {
|
||||||
|
display_nickname : $('#nickname').val() || '',
|
||||||
|
display_username : $('#user_login').val() || '',
|
||||||
|
display_firstname : $('#first_name').val() || '',
|
||||||
|
display_lastname : $('#last_name').val() || ''
|
||||||
|
};
|
||||||
|
|
||||||
if ( inputs.display_firstname && inputs.display_lastname ) {
|
if ( inputs.display_firstname && inputs.display_lastname ) {
|
||||||
inputs['display_firstlast'] = inputs.display_firstname + ' ' + inputs.display_lastname;
|
inputs['display_firstlast'] = inputs.display_firstname + ' ' + inputs.display_lastname;
|
||||||
|
@ -50,6 +56,9 @@
|
||||||
|
|
||||||
$('option', select).remove();
|
$('option', select).remove();
|
||||||
$.each(inputs, function( id, value ) {
|
$.each(inputs, function( id, value ) {
|
||||||
|
if ( !value )
|
||||||
|
return;
|
||||||
|
|
||||||
var val = value.replace(/<\/?[a-z][^>]*>/gi, '');
|
var val = value.replace(/<\/?[a-z][^>]*>/gi, '');
|
||||||
|
|
||||||
if ( inputs[id].length && $.inArray( val, dub ) == -1 ) {
|
if ( inputs[id].length && $.inArray( val, dub ) == -1 ) {
|
||||||
|
|
Loading…
Reference in New Issue