WordPress.org

Make WordPress Core

Ticket #34744: 34744.diff

File 34744.diff, 1.3 KB (added by henry.wright, 4 years ago)
  • src/wp-admin/options-discussion.php

    diff --git src/wp-admin/options-discussion.php src/wp-admin/options-discussion.php
    index 3d59195..476403e 100644
    $avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults ); 
    242242$default = get_option( 'avatar_default', 'mystery' );
    243243$size = 32;
    244244$avatar_list = '';
     245$args = array(
     246        'force_default' => true
     247);
    245248
    246249// Force avatars on to display these choices
    247250add_filter( 'pre_option_show_avatars', '__return_true', 100 );
    add_filter( 'pre_option_show_avatars', '__return_true', 100 ); 
    249252foreach ( $avatar_defaults as $default_key => $default_name ) {
    250253        $selected = ($default == $default_key) ? 'checked="checked" ' : '';
    251254        $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr($default_key) . "' {$selected}/> ";
    252 
    253         $avatar = get_avatar( $user_email, $size, $default_key );
    254         $avatar = preg_replace( "/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar );
    255         $avatar = preg_replace( "/srcset='(.+?) 2x'/", "srcset='\$1&amp;forcedefault=1 2x'", $avatar );
    256         $avatar_list .= $avatar;
    257 
     255        $avatar_list .= get_avatar( $user_email, $size, $default_key, '', $args );
    258256        $avatar_list .= ' ' . $default_name . '</label>';
    259257        $avatar_list .= '<br />';
    260258}