diff --git wp-admin/includes/template.php wp-admin/includes/template.php
index a788b8f..5d112ce 100644
|
|
function the_attachment_links( $id = false ) { |
759 | 759 | * @param string $selected slug for the role that should be already selected |
760 | 760 | */ |
761 | 761 | function wp_dropdown_roles( $selected = false ) { |
762 | | $p = ''; |
763 | 762 | $r = ''; |
764 | 763 | |
765 | | $editable_roles = get_editable_roles(); |
| 764 | $editable_roles = array_reverse(get_editable_roles()); |
766 | 765 | |
767 | 766 | foreach ( $editable_roles as $role => $details ) { |
768 | 767 | $name = translate_user_role($details['name'] ); |
769 | 768 | if ( $selected == $role ) // preselect specified role |
770 | | $p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>"; |
| 769 | $r .= "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>"; |
771 | 770 | else |
772 | 771 | $r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>"; |
773 | 772 | } |
774 | | echo $p . $r; |
| 773 | echo $r; |
775 | 774 | } |
776 | 775 | |
777 | 776 | /** |
diff --git wp-admin/options-general.php wp-admin/options-general.php
index 57a1b14..4da6f6b 100644
|
|
include('./admin-header.php'); |
113 | 113 | </fieldset></td> |
114 | 114 | </tr> |
115 | 115 | <tr valign="top"> |
116 | | <th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th> |
| 116 | <th scope="row"><label for="default_role"><?php _e('New User Default Role'); ?></label></th> |
117 | 117 | <td> |
118 | 118 | <select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select> |
119 | 119 | </td> |
diff --git wp-includes/capabilities.php wp-includes/capabilities.php
index 7d8a00d..9c00296 100644
|
|
class WP_Roles { |
166 | 166 | |
167 | 167 | if ( $this->use_db ) |
168 | 168 | update_option( $this->role_key, $this->roles ); |
| 169 | |
| 170 | if ( get_option( 'default_role' ) == $role ) |
| 171 | update_option( 'default_role', 'subscriber' ); |
169 | 172 | } |
170 | 173 | |
171 | 174 | /** |
… |
… |
class WP_Roles { |
206 | 209 | * @access public |
207 | 210 | * |
208 | 211 | * @param string $role Role name. |
209 | | * @return object|null Null, if role does not exist. WP_Role object, if found. |
| 212 | * @return object|null empty object, if role does not exist. WP_Role object, if found. |
210 | 213 | */ |
211 | 214 | function &get_role( $role ) { |
212 | | if ( isset( $this->role_objects[$role] ) ) |
| 215 | if ( isset( $this->role_objects[$role] ) ) { |
213 | 216 | return $this->role_objects[$role]; |
214 | | else |
215 | | return null; |
| 217 | } |
| 218 | else { |
| 219 | $obj = null; // prevent invalid variable reference notice |
| 220 | return $obj; |
| 221 | } |
216 | 222 | } |
217 | 223 | |
218 | 224 | /** |
… |
… |
function user_can( $user, $capability ) { |
1118 | 1124 | * @param string $role Role name. |
1119 | 1125 | * @return object |
1120 | 1126 | */ |
1121 | | function get_role( $role ) { |
| 1127 | function &get_role( $role ) { |
1122 | 1128 | global $wp_roles; |
1123 | 1129 | |
1124 | 1130 | if ( ! isset( $wp_roles ) ) |
diff --git wp-includes/default-filters.php wp-includes/default-filters.php
index c796453..fda9a2b 100644
|
|
add_filter( 'option_ping_sites', 'privacy_ping_filter' ); |
172 | 172 | add_filter( 'option_blog_charset', '_wp_specialchars' ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop |
173 | 173 | add_filter( 'option_home', '_config_wp_home' ); |
174 | 174 | add_filter( 'option_siteurl', '_config_wp_siteurl' ); |
| 175 | add_filter( 'option_default_role', '_wp_filter_verify_default_role' ); |
175 | 176 | add_filter( 'tiny_mce_before_init', '_mce_set_direction' ); |
176 | 177 | add_filter( 'pre_kses', 'wp_pre_kses_less_than' ); |
177 | 178 | add_filter( 'sanitize_title', 'sanitize_title_with_dashes' ); |
diff --git wp-includes/functions.php wp-includes/functions.php
index abcb63d..19473fa 100644
|
|
function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = ar |
4471 | 4471 | return false; |
4472 | 4472 | } |
4473 | 4473 | |
| 4474 | function _wp_filter_verify_default_role( $role ) { |
| 4475 | $role_obj = get_role( $role ); |
| 4476 | if ( empty( $role_obj ) ) |
| 4477 | $role = 'subscriber'; |
| 4478 | return $role; |
| 4479 | } |
4474 | 4480 | ?> |