WordPress.org

Make WordPress Core

Changeset 7879


Ignore:
Timestamp:
05/03/2008 12:56:16 AM (10 years ago)
Author:
ryan
Message:

Default avatar selector. Props Viper007Bond. see #6802

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/schema.php

    r7848 r7879  
    254254    add_option('medium_size_h', 300);
    255255
     256    // 2.6
     257    add_option('avatar_default', 'default');
     258
    256259    // Delete unused options
    257260    $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval');
  • trunk/wp-admin/options-discussion.php

    r7498 r7879  
    8585<table class="form-table">
    8686<tr valign="top">
    87 <th scope="row"><?php _e('Avatar display') ?></th>
     87<th scope="row"><?php _e('Avatar Display') ?></th>
    8888<td>
    8989<?php
     
    9191    foreach ( $yesorno as $key => $value) {
    9292        $selected = (get_option('show_avatars') == $key) ? 'checked="checked"' : '';
    93         echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected> $value</label><br />";
     93        echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected/> $value</label><br />";
    9494    }
    9595?>
     
    104104foreach ($ratings as $key => $rating) :
    105105    $selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : '';
    106     echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected> $rating</label><br />";
     106    echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected/> $rating</label><br />";
    107107endforeach;
     108?>
     109
     110</td>
     111</tr>
     112<tr valign="top">
     113<th scope="row"><?php _e('Default Avatar') ?></th>
     114<td class="defaultavatarpicker">
     115
     116<?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 e-mail address.'); ?><br />
     117
     118<?php
     119$avatar_defaults = array(
     120    'default' => __('Default'),
     121    'gravatar_default' => __('Gravatar Logo'),
     122    'identicon' => __('Identicon (Generated)'),
     123    'wavatar' => __('Wavatar (Generated)'),
     124    'monsterid' => __('MonsterID (Generated)')
     125);
     126$avatar_defaults = apply_filters('avatar_defaults', $avatar_defaults);
     127$default = get_option('avatar_default');
     128if ( empty($default) )
     129    $default = 'default';
     130$size = 32;
     131$avatar_list = '';
     132foreach ( $avatar_defaults as $default_key => $default_name ) {
     133    $selected = ($default == $default_key) ? 'checked="checked" ' : '';
     134    $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='{$default_key}' {$selected}/> ";
     135
     136    $avatar = get_avatar( $user_email, $size, $default_key );
     137    $avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar);
     138
     139    $avatar_list .= ' ' . $default_name . '</label>';
     140    $avatar_list .= '<br />';
     141}
     142echo apply_filters('default_avatar_select', $avatar_list);
    108143?>
    109144
     
    116151<p class="submit">
    117152<input type="hidden" name="action" value="update" />
    118 <input type="hidden" name="page_options" value="default_pingback_flag,default_ping_status,default_comment_status,comments_notify,moderation_notify,comment_moderation,require_name_email,comment_whitelist,comment_max_links,moderation_keys,blacklist_keys,show_avatars,avatar_rating" />
     153<input type="hidden" name="page_options" value="default_pingback_flag,default_ping_status,default_comment_status,comments_notify,moderation_notify,comment_moderation,require_name_email,comment_whitelist,comment_max_links,moderation_keys,blacklist_keys,show_avatars,avatar_rating,avatar_default" />
    119154<input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
    120155</p>
  • trunk/wp-admin/wp-admin.css

    r7854 r7879  
    13571357}
    13581358
     1359.defaultavatarpicker .avatar {
     1360    margin: 2px 0;
     1361    vertical-align: middle;
     1362}
     1363
    13591364body.minwidth {
    13601365    min-width: 808px;
  • trunk/wp-includes/pluggable.php

    r7836 r7879  
    12441244    }
    12451245
    1246     if ( empty($default) )
    1247         $default = "http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=$size"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
     1246    if ( empty($default) ) {
     1247        $avatar_default = get_option('avatar_default');
     1248        if ( empty($avatar_default) )
     1249            $default = 'default';
     1250        else
     1251            $default = $avatar_default;
     1252    }
     1253
     1254    if ( 'custom' == $default )
     1255        $default = add_query_arg( 's', $size, $defaults[$avatar_default][1] );
     1256    elseif ( 'default' == $default )
     1257        $default = "http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
     1258    elseif ( !empty($email) && 'gravatar_default' == $default )
     1259        $default = '';
     1260    elseif ( 'gravatar_default' == $default )
     1261        $default = "http://www.gravatar.com/avatar/s={$size}";
     1262    elseif ( empty($email) )
     1263        $default = "http://www.gravatar.com/avatar/?d=$default&amp;s={$size}";
    12481264
    12491265    if ( !empty($email) ) {
Note: See TracChangeset for help on using the changeset viewer.