WordPress.org

Make WordPress Core

Changeset 8135


Ignore:
Timestamp:
06/20/2008 03:28:22 PM (10 years ago)
Author:
westi
Message:

Update nickname in display name dropdown dynamically. Fixes #5691 props hansengel.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/user-edit.php

    r7898 r8135  
    4141        }
    4242
     43    }
     44   
     45    function update_nickname ( ) {
     46       
     47        var nickname = jQuery('#nickname').val();
     48        var display_nickname = jQuery('#display_nickname').val();
     49       
     50        if ( nickname == '' ) {
     51            jQuery('#display_nickname').remove();
     52        }
     53        jQuery('#display_nickname').val(nickname).html(nickname);
     54       
    4355    }
    4456
     
    5062    jQuery(document).ready( function() {
    5163        jQuery('#pass1,#pass2').attr('autocomplete','off');
     64        jQuery('#nickname').blur(update_nickname);
    5265    });
    5366</script>
     
    246259        <?php
    247260            $public_display = array();
    248             $public_display[] = $profileuser->display_name;
    249             $public_display[] = $profileuser->nickname;
    250             $public_display[] = $profileuser->user_login;
    251             $public_display[] = $profileuser->first_name;
    252             $public_display[] = $profileuser->first_name.' '.$profileuser->last_name;
    253             $public_display[] = $profileuser->last_name.' '.$profileuser->first_name;
     261            $public_display['display_displayname'] = $profileuser->display_name;
     262            $public_display['display_nickname'] = $profileuser->nickname;
     263            $public_display['display_username'] = $profileuser->user_login;
     264            $public_display['display_firstname'] = $profileuser->first_name;
     265            $public_display['display_firstlast'] = $profileuser->first_name.' '.$profileuser->last_name;
     266            $public_display['display_lastfirst'] = $profileuser->last_name.' '.$profileuser->first_name;
    254267            $public_display = array_unique(array_filter(array_map('trim', $public_display)));
    255             foreach($public_display as $item) {
     268            foreach($public_display as $id => $item) {
    256269        ?>
    257             <option value="<?php echo $item; ?>"><?php echo $item; ?></option>
     270            <option id="<?php echo $id; ?>" value="<?php echo $item; ?>"><?php echo $item; ?></option>
    258271        <?php
    259272            }
Note: See TracChangeset for help on using the changeset viewer.