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:
parent
e4dc691e75
commit
d93d8b850d
|
@ -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'] );
|
||||
|
|
|
@ -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' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue