diff --git src/wp-admin/options-discussion.php src/wp-admin/options-discussion.php
index fefc0d8..1c715a8 100644
|
|
|
217 | 217 | <th scope="row"><?php _e('Default Avatar'); ?></th> |
218 | 218 | <td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e('Default Avatar'); ?></span></legend> |
219 | 219 | |
220 | | <?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their email address.'); ?><br /> |
221 | | |
222 | 220 | <?php |
223 | | $avatar_defaults = array( |
| 221 | |
| 222 | $static_avatars = array( |
224 | 223 | 'mystery' => __('Mystery Person'), |
225 | 224 | 'blank' => __('Blank'), |
226 | | 'gravatar_default' => __('Gravatar Logo'), |
| 225 | 'gravatar_default' => __('Gravatar Logo') |
| 226 | ); |
| 227 | |
| 228 | $avatar_generated = array( |
227 | 229 | 'identicon' => __('Identicon (Generated)'), |
228 | 230 | 'wavatar' => __('Wavatar (Generated)'), |
229 | 231 | 'monsterid' => __('MonsterID (Generated)'), |
230 | 232 | 'retro' => __('Retro (Generated)') |
231 | 233 | ); |
| 234 | |
| 235 | /** |
| 236 | * Filters the generated avatars. |
| 237 | * |
| 238 | * Avatars are stored in key/value pairs, where the key is option value, |
| 239 | * and the name is the displayed avatar name. |
| 240 | * |
| 241 | * @since 4.8.0 |
| 242 | * |
| 243 | * @param array $avatar_generated Array of default avatars. |
| 244 | */ |
| 245 | $static_avatars = apply_filters( 'default_static_avatars', $static_avatars ); |
| 246 | |
| 247 | /** |
| 248 | * Filters the generated avatars. |
| 249 | * |
| 250 | * Avatars are stored in key/value pairs, where the key is option value, |
| 251 | * and the name is the displayed avatar name. |
| 252 | * |
| 253 | * @since 4.8.0 |
| 254 | * |
| 255 | * @param array $avatar_generated Array of default avatars. |
| 256 | */ |
| 257 | $avatar_generated = apply_filters( 'default_generated_avatars', $avatar_generated ); |
| 258 | |
| 259 | // Merge the two avatar types together |
| 260 | $avatar_defaults = array_merge( $static_avatars, $avatar_generated ); |
| 261 | |
232 | 262 | /** |
233 | 263 | * Filters the default avatars. |
234 | 264 | * |
… |
… |
|
239 | 269 | * |
240 | 270 | * @param array $avatar_defaults Array of default avatars. |
241 | 271 | */ |
242 | | $avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults ); |
| 272 | $new_avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults ); |
| 273 | |
| 274 | if ( array_intersect_key( $new_avatar_defaults, $avatar_generated ) ) { |
| 275 | $default_avatar_help = __( 'For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their email address.'); |
| 276 | } else { |
| 277 | $default_avatar_help = __( 'For users without a custom avatar of their own, you can display a generic logo instead.'); |
| 278 | } |
| 279 | |
| 280 | /** |
| 281 | * Filters the help text used for default avatars. |
| 282 | * |
| 283 | * Avatars are stored in key/value pairs, where the key is option value, |
| 284 | * and the name is the displayed avatar name. |
| 285 | * |
| 286 | * @since 4.8.0 |
| 287 | * |
| 288 | * @param array $default_avatar_help Array of default avatars. |
| 289 | */ |
| 290 | $default_avatar_help = apply_filters( 'default_avatar_help', $default_avatar_help ); |
| 291 | |
| 292 | // Maybe output default avatar help text |
| 293 | if ( ! empty( $default_avatar_help ) ) { |
| 294 | echo '<p><label for="avatar_default">'. $default_avatar_help . '</label></p>'; |
| 295 | } |
| 296 | |
243 | 297 | $default = get_option( 'avatar_default', 'mystery' ); |
244 | 298 | $avatar_list = ''; |
245 | 299 | |
246 | 300 | // Force avatars on to display these choices |
247 | 301 | add_filter( 'pre_option_show_avatars', '__return_true', 100 ); |
248 | 302 | |
249 | | foreach ( $avatar_defaults as $default_key => $default_name ) { |
| 303 | foreach ( $new_avatar_defaults as $default_key => $default_name ) { |
250 | 304 | $selected = ($default == $default_key) ? 'checked="checked" ' : ''; |
251 | 305 | $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr($default_key) . "' {$selected}/> "; |
252 | 306 | $avatar_list .= get_avatar( $user_email, 32, $default_key, '', array( 'force_default' => true ) ); |