Index: wp-admin/includes/schema.php
===================================================================
--- wp-admin/includes/schema.php	(revision 7817)
+++ wp-admin/includes/schema.php	(working copy)
@@ -250,6 +250,10 @@
 	add_option('medium_size_w', 300);
 	add_option('medium_size_h', 300);
 
+	// 2.5.1
+	add_option('avatar_default', 'default');
+	add_option('avatar_custom');
+
 	// Delete unused options
 	$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');
 	foreach ($unusedoptions as $option) :
Index: wp-admin/options-discussion.php
===================================================================
--- wp-admin/options-discussion.php	(revision 7817)
+++ wp-admin/options-discussion.php	(working copy)
@@ -84,13 +84,13 @@
 
 <table class="form-table">
 <tr valign="top">
-<th scope="row"><?php _e('Avatar display') ?></th>
+<th scope="row"><?php _e('Avatar Display') ?></th>
 <td>
 <?php
 	$yesorno = array(0 => __("Don&#8217;t show Avatars"), 1 => __('Show Avatars'));
 	foreach ( $yesorno as $key => $value) {
 		$selected = (get_option('show_avatars') == $key) ? 'checked="checked"' : '';
-		echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected> $value</label><br />";
+		echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected/> $value</label><br />";
 	}
 ?>
 </td>
@@ -103,19 +103,52 @@
 $ratings = array( 'G' => __('G &#8212; Suitable for all audiences'), 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), 'R' => __('R &#8212; Intended for adult audiences above 17'), 'X' => __('X &#8212; Even more mature than above'));
 foreach ($ratings as $key => $rating) :
 	$selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : '';
-	echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected> $rating</label><br />";
+	echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected/> $rating</label><br />";
 endforeach;
 ?>
 
 </td>
 </tr>
+<tr valign="top">
+<th scope="row"><?php _e('Default Avatar') ?></th>
+<td class="defaultavatarpicker">
 
+<?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 />
+
+<?php
+$defaults = apply_filters( 'avatar_defaults', array() );
+$size = 32;
+foreach ( $defaults as $key => $default ) {
+	$selected = (get_option('avatar_default') == $key) ? 'checked="checked" ' : '';
+	echo "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$key}' value='{$key}' {$selected}/> ";
+
+	if ( !('custom' == $key && empty($default[1])) ) {
+		if ( 'default' == $key || 'gravatarlogo' == $key ) {
+			$img = 'http://www.gravatar.com/avatar/' . $default[1] . "?s={$size}";
+		} elseif ( 'custom' == $key && !empty($default[1]) ) {
+			$img = add_query_arg( 's', $size, $default[1] );
+		} else {
+			$img = 'http://www.gravatar.com/avatar/' . md5($user_email) . '?d=' . $default[1] . "&s={$size}&forcedefault=1";
+		}
+
+		echo "<img alt='' src='" . htmlspecialchars( $img ) . "' class='avatar avatar-{$size}' height='{$size}' width='{$size}' />";
+	}
+
+	echo ' ' . $default[0] . '</label>';
+	if ( 'custom' == $key ) echo ': <input type="text" name="avatar_custom" value="' . attribute_escape ( $default[1] ) . '" size="75" class="code" onfocus="document.getElementById(\'avatar_custom\').checked = \'checked\';" />';
+	echo '<br />';
+}
+?>
+
+</td>
+</tr>
+
 </table>
 
 
 <p class="submit">
 <input type="hidden" name="action" value="update" />
-<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" />
+<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,avatar_custom" />
 <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
 </p>
 </form>
Index: wp-admin/wp-admin.css
===================================================================
--- wp-admin/wp-admin.css	(revision 7817)
+++ wp-admin/wp-admin.css	(working copy)
@@ -1341,6 +1341,11 @@
 	vertical-align:text-top;
 }
 
+.defaultavatarpicker .avatar {
+	margin: 2px 0;
+	vertical-align: middle;
+}
+
 body.minwidth {
 	min-width: 808px;
 }
Index: wp-includes/default-filters.php
===================================================================
--- wp-includes/default-filters.php	(revision 7817)
+++ wp-includes/default-filters.php	(working copy)
@@ -153,6 +153,7 @@
 add_filter('comment_flood_filter', 'wp_throttle_comment_flood', 10, 3);
 add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
 add_filter('comment_email', 'antispambot');
+add_filter('avatar_defaults', 'avatar_defaults_filter', 5);
 
 //Atom SSL support
 add_filter('atom_service_url','atom_service_url_filter');
Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 7817)
+++ wp-includes/functions.php	(working copy)
@@ -1749,4 +1749,23 @@
 	return $default;
 }
 
-?>
+/**
+ * avatar_defaults_filter() - Returns an array of default avatars for the user to pick from.
+ *
+ * @since 2.5.1
+ * @param array $defaults Existing array of default avatars
+ */
+function avatar_defaults_filter( $defaults ) {
+	$avatar_defaults = array(
+		'default' => array( __('Default'), 'ad516503a11cd5ca435acc9bb6523536' ), // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
+		'gravatarlogo' => array( __('Gravatar Logo'), 'default' ),
+		'identicon' => array( __('Identicon (Generated)'), 'identicon' ),
+		'wavatar' => array( __('Wavatar (Generated)'), 'wavatar' ),
+		'monsterid' => array( __('MonsterID (Generated)'), 'monsterid' ),
+		'custom' => array( __('Custom'), get_option('avatar_custom') )
+	);
+
+	return $defaults + $avatar_defaults;
+}
+
+?>
\ No newline at end of file
Index: wp-includes/pluggable.php
===================================================================
--- wp-includes/pluggable.php	(revision 7817)
+++ wp-includes/pluggable.php	(working copy)
@@ -1235,8 +1235,20 @@
 		$email = $id_or_email;
 	}
 
+	$defaults = apply_filters( 'avatar_defaults', array() );
+	$avatar_default = get_option('avatar_default');
+
+	if ( empty($default) && 'custom' == $avatar_default && !empty($defaults[$avatar_default][1]) )
+		$default = add_query_arg( 's', $size, $defaults[$avatar_default][1] );
+
+	if ( empty($default) && ( 'default' == $avatar_default || 'gravatarlogo' == $avatar_default ) )
+		$default = 'http://www.gravatar.com/avatar/' . $defaults[$avatar_default][1] . "?s={$size}";
+
+	if ( empty($default) && !empty($email) && isset($defaults[$avatar_default]) )
+		$default = $defaults[$avatar_default][1];
+
 	if ( empty($default) )
-		$default = "http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=$size"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
+		$default = 'http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536'; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
 
 	if ( !empty($email) ) {
 		$out = 'http://www.gravatar.com/avatar/';
Index: wp-includes/version.php
===================================================================
--- wp-includes/version.php	(revision 7817)
+++ wp-includes/version.php	(working copy)
@@ -16,6 +16,6 @@
  *
  * @global int $wp_db_version
  */
-$wp_db_version = 7796;
+$wp_db_version = 7827;
 
 ?>

