Make WordPress Core

Ticket #30161: 30161.3.diff

File 30161.3.diff, 1.4 KB (added by krogsgard, 10 years ago)

Preserve old avatars for those that have its selected, until they change.

  • wp-admin/options-discussion.php

     
    215215
    216216<?php
    217217$avatar_defaults = array(
    218         'mystery' => __('Mystery Man'),
     218        'mystery' => __('Mystery Person'),
    219219        'blank' => __('Blank'),
     220        'identicon' => __('Identicon (Generated)')
     221);
     222
     223$avatars_old = array (
    220224        'gravatar_default' => __('Gravatar Logo'),
    221         'identicon' => __('Identicon (Generated)'),
    222225        'wavatar' => __('Wavatar (Generated)'),
    223226        'monsterid' => __('MonsterID (Generated)'),
    224227        'retro' => __('Retro (Generated)')
    225228);
     229
    226230/**
    227231 * Filter the default avatars.
    228232 *
     
    235239 */
    236240$avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults );
    237241$default = get_option('avatar_default');
    238 if ( empty($default) )
     242if ( empty($default) ) {
    239243        $default = 'mystery';
     244}
     245
     246if ( in_array( $default, array_keys( $avatars_old ) ) ) {
     247        $avatar_defaults[$default] = $avatars_old[$default];
     248}
     249
    240250$size = 32;
    241251$avatar_list = '';
    242252foreach ( $avatar_defaults as $default_key => $default_name ) {
    243253        $selected = ($default == $default_key) ? 'checked="checked" ' : '';
     254
    244255        $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr($default_key) . "' {$selected}/> ";
    245256
    246257        $avatar = get_avatar( $user_email, $size, $default_key );