Make WordPress Core

Ticket #13743: 13743.5.patch

File 13743.5.patch, 3.0 KB (added by PieWP, 8 years ago)

Added fallback message for select not rendering

  • wp-admin/includes/schema.php

     
    364364        } else {
    365365                $uploads_use_yearmonth_folders = 1;
    366366        }
     367       
     368        $stylesheet = $template = WP_DEFAULT_THEME;
     369       
     370        // If it's multisite and WP_DEFAULT_THEME is not redifined in WP Config, get the network default theme
     371        if ( is_multisite() ) {
     372                $default_theme = get_site_option( 'default_theme', false );
     373               
     374                if ( ! empty( $default_theme ) ) {
     375                        $theme = wp_get_theme( $default_theme );
     376                        if ( $theme->exists() ) {
     377                                $stylesheet = $theme->get_stylesheet();
     378                                $template   = $theme->get_template();
     379                        }
     380                }
     381        }
    367382
    368383        // If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme.
    369         $stylesheet = $template = WP_DEFAULT_THEME;
    370         $theme = wp_get_theme( WP_DEFAULT_THEME );
    371         if ( ! $theme->exists() ) {
    372                 $theme = WP_Theme::get_core_default_theme();
     384        if ( empty ( $theme ) || ! $theme->exists() ) {
     385                $theme = wp_get_theme( WP_DEFAULT_THEME );
     386       
     387                if ( ! $theme->exists() ) {
     388                        $theme = WP_Theme::get_core_default_theme();
     389                }
    373390        }
    374391
    375392        // If we can't find a core default theme, WP_DEFAULT_THEME is the best we can do.
  • wp-admin/network/settings.php

     
    5959                'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author',
    6060                'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'global_terms_enabled',
    6161                'illegal_names', 'limited_email_domains', 'banned_email_domains', 'WPLANG', 'admin_email',
    62                 'first_comment_email',
     62                'first_comment_email', 'default_theme'
    6363        );
    6464
    6565        // Handle translation install.
     
    202202                </table>
    203203                <h2><?php _e( 'New Site Settings' ); ?></h2>
    204204                <table class="form-table">
    205 
     205                       
    206206                        <tr>
     207                                <th scope="row"><label for="default_theme"><?php _e( 'Default Theme' ) ?></label></th>
     208                                <td>
     209                                        <?php
     210                                        $themes = wp_get_themes( array( 'errors' => false, 'allowed' => 'network' ) );
     211                                        if ( ! empty( $themes ) && is_array( $themes ) ) {
     212                                                echo "<select name='default_theme' id='default_theme'>\n";
     213                                                $default_theme = get_site_option( 'default_theme', WP_DEFAULT_THEME );
     214                                                foreach ( $themes as $theme ) {
     215                                                        printf( "\t<option value='%s' %s>%s</option>\n",
     216                                                                $theme->stylesheet,
     217                                                                selected( $theme->stylesheet, $default_theme, false ),
     218                                                                $theme
     219                                                        );
     220                                                }
     221                                                echo "</select>\n";
     222                                        }
     223                                        else
     224                                        {
     225                                                _e( 'You currently don\'t have any themes installed' );
     226                                        }
     227                                        ?>
     228                                </td>
     229                        </tr>
     230                        <tr>
    207231                                <th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th>
    208232                                <td>
    209233                                        <textarea name="welcome_email" id="welcome_email" aria-describedby="welcome-email-desc" rows="5" cols="45" class="large-text">