Admin: Fix default avatar handling in Settings -> Discussion.
By passing the `force_default` argument to `get_avatar()` instead of using `preg_replace`, we make it easier for developers to override the output. Props henry.wright. Fixes #34744. Built from https://develop.svn.wordpress.org/trunk@37227 git-svn-id: http://core.svn.wordpress.org/trunk@37193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
698ca25fb9
commit
026ed07458
|
@ -240,7 +240,6 @@ $avatar_defaults = array(
|
|||
*/
|
||||
$avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults );
|
||||
$default = get_option( 'avatar_default', 'mystery' );
|
||||
$size = 32;
|
||||
$avatar_list = '';
|
||||
|
||||
// Force avatars on to display these choices
|
||||
|
@ -249,12 +248,7 @@ add_filter( 'pre_option_show_avatars', '__return_true', 100 );
|
|||
foreach ( $avatar_defaults as $default_key => $default_name ) {
|
||||
$selected = ($default == $default_key) ? 'checked="checked" ' : '';
|
||||
$avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr($default_key) . "' {$selected}/> ";
|
||||
|
||||
$avatar = get_avatar( $user_email, $size, $default_key );
|
||||
$avatar = preg_replace( "/src='(.+?)'/", "src='\$1&forcedefault=1'", $avatar );
|
||||
$avatar = preg_replace( "/srcset='(.+?) 2x'/", "srcset='\$1&forcedefault=1 2x'", $avatar );
|
||||
$avatar_list .= $avatar;
|
||||
|
||||
$avatar_list .= get_avatar( $user_email, 32, $default_key, '', array( 'force_default' => true ) );
|
||||
$avatar_list .= ' ' . $default_name . '</label>';
|
||||
$avatar_list .= '<br />';
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-alpha-37226';
|
||||
$wp_version = '4.6-alpha-37227';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue