WordPress.org

Make WordPress Core

Ticket #14578: 14578.2.diff

File 14578.2.diff, 2.9 KB (added by wonderboymusic, 8 years ago)
  • wp-admin/includes/template.php

    diff --git wp-admin/includes/template.php wp-admin/includes/template.php
    index d426533..538fe3a 100644
    function the_attachment_links( $id = false ) { 
    754754 * @param string $selected slug for the role that should be already selected
    755755 */
    756756function wp_dropdown_roles( $selected = false ) {
    757         $p = '';
    758757        $r = '';
    759758
    760         $editable_roles = get_editable_roles();
     759        $editable_roles = array_reverse( get_editable_roles() );
    761760
    762761        foreach ( $editable_roles as $role => $details ) {
    763762                $name = translate_user_role($details['name'] );
    764763                if ( $selected == $role ) // preselect specified role
    765                         $p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>";
     764                        $r .= "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>";
    766765                else
    767766                        $r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>";
    768767        }
    769         echo $p . $r;
     768        echo $r;
    770769}
    771770
    772771/**
  • wp-includes/capabilities.php

    diff --git wp-includes/capabilities.php wp-includes/capabilities.php
    index c3bb58f..3ab4a49 100644
    class WP_Roles { 
    167167                $this->roles[$role] = array(
    168168                        'name' => $display_name,
    169169                        'capabilities' => $capabilities
    170                         );
     170                );
    171171                if ( $this->use_db )
    172172                        update_option( $this->role_key, $this->roles );
    173173                $this->role_objects[$role] = new WP_Role( $role, $capabilities );
    class WP_Roles { 
    193193
    194194                if ( $this->use_db )
    195195                        update_option( $this->role_key, $this->roles );
     196
     197                if ( get_option( 'default_role' ) == $role )
     198                        update_option( 'default_role', 'subscriber' );
    196199        }
    197200
    198201        /**
    function is_super_admin( $user_id = false ) { 
    14661469
    14671470        return false;
    14681471}
     1472
     1473/**
     1474 * Filter "default_role" option
     1475 *
     1476 * @since 3.7.0
     1477 *
     1478 * @param string $role Role name.
     1479 * @return string Filtered default role.
     1480 */
     1481function _wp_filter_verify_default_role( $role ) {
     1482        $role_obj = get_role( $role );
     1483        if ( empty( $role_obj ) )
     1484                $role = 'subscriber';
     1485
     1486        return $role;
     1487}
     1488 No newline at end of file
  • wp-includes/default-filters.php

    diff --git wp-includes/default-filters.php wp-includes/default-filters.php
    index de97238..c71272d 100644
    add_filter( 'option_blog_charset', '_wp_specialchars' ); 
    178178add_filter( 'option_blog_charset',      '_canonical_charset'                  );
    179179add_filter( 'option_home',              '_config_wp_home'                     );
    180180add_filter( 'option_siteurl',           '_config_wp_siteurl'                  );
     181add_filter( 'option_default_role',      '_wp_filter_verify_default_role'      );
    181182add_filter( 'tiny_mce_before_init',     '_mce_set_direction'                  );
    182183add_filter( 'pre_kses',                 'wp_pre_kses_less_than'               );
    183184add_filter( 'sanitize_title',           'sanitize_title_with_dashes',   10, 3 );