Reverse the order of roles in wp_dropdown_roles(). Reset to 'subscriber' when the default role is removed and when a save is invalid.

props garyc40, wonderboymusic.
fixes #14578.

Built from https://develop.svn.wordpress.org/trunk@25695


git-svn-id: http://core.svn.wordpress.org/trunk@25610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-10-06 10:56:09 +00:00
parent e4dc691e75
commit d93d8b850d
3 changed files with 9 additions and 1 deletions

View File

@ -756,7 +756,7 @@ function wp_dropdown_roles( $selected = false ) {
$p = '';
$r = '';
$editable_roles = get_editable_roles();
$editable_roles = array_reverse( get_editable_roles() );
foreach ( $editable_roles as $role => $details ) {
$name = translate_user_role($details['name'] );

View File

@ -193,6 +193,9 @@ class WP_Roles {
if ( $this->use_db )
update_option( $this->role_key, $this->roles );
if ( get_option( 'default_role' ) == $role )
update_option( 'default_role', 'subscriber' );
}
/**

View File

@ -2957,6 +2957,11 @@ function sanitize_option($option, $value) {
$value = esc_url_raw( $value );
$value = str_replace( 'http://', '', $value );
break;
case 'default_role' :
if ( ! get_role( $value ) && get_role( 'subscriber' ) )
$value = 'subscriber';
break;
}
$value = apply_filters("sanitize_option_{$option}", $value, $option);