WordPress.org

Make WordPress Core

Ticket #5508: unique-display-name-suggestions.diff

File unique-display-name-suggestions.diff, 2.0 KB (added by nbachiyski, 14 years ago)
  • wp-admin/user-edit.php

     
    126126
    127127<p><label><?php _e('Display name publicly as:') ?> <br />
    128128<select name="display_name">
    129 <option value="<?php echo $profileuser->display_name; ?>"><?php echo $profileuser->display_name; ?></option>
    130 <option value="<?php echo $profileuser->nickname ?>"><?php echo $profileuser->nickname ?></option>
    131 <option value="<?php echo $profileuser->user_login ?>"><?php echo $profileuser->user_login ?></option>
    132 <?php if ( !empty( $profileuser->first_name ) ) : ?>
    133 <option value="<?php echo $profileuser->first_name ?>"><?php echo $profileuser->first_name ?></option>
    134 <?php endif; ?>
    135 <?php if ( !empty( $profileuser->last_name ) ) : ?>
    136 <option value="<?php echo $profileuser->last_name ?>"><?php echo $profileuser->last_name ?></option>
    137 <?php endif; ?>
    138 <?php if ( !empty( $profileuser->first_name ) && !empty( $profileuser->last_name ) ) : ?>
    139 <option value="<?php echo $profileuser->first_name." ".$profileuser->last_name ?>"><?php echo $profileuser->first_name." ".$profileuser->last_name ?></option>
    140 <option value="<?php echo $profileuser->last_name." ".$profileuser->first_name ?>"><?php echo $profileuser->last_name." ".$profileuser->first_name ?></option>
    141 <?php endif; ?>
     129<?php
     130        $public_display = array();
     131        $public_display[] = $profileuser->display_name;
     132        $public_display[] = $profileuser->nickname;
     133        $public_display[] = $profileuser->user_login;
     134        $public_display[] = $profileuser->first_name;
     135        $public_display[] = $profileuser->first_name.' '.$profileuser->last_name;
     136        $public_display[] = $profileuser->last_name.' '.$profileuser->first_name;
     137        $public_display = array_unique(array_filter(array_map('trim', $public_display)));
     138        foreach($public_display as $item) {
     139?>
     140        <option value="<?php echo $item; ?>"><?php echo $item; ?></option>
     141<?php
     142        }
     143?>
    142144</select></label></p>
    143145</fieldset>
    144146