WordPress.org

Make WordPress Core

Ticket #19089: 19089.patch

File 19089.patch, 1.6 KB (added by azaozz, 7 years ago)

Fix notice and show a warning on the dashboard when there aren't any themes available

  • wp-admin/includes/dashboard.php

     
    387387        $ct = current_theme_info();
    388388
    389389        echo "\n\t<p>";
    390         if ( !empty($wp_registered_sidebars) ) {
     390
     391        if ( empty($ct->stylesheet_dir) ) {
     392                if ( !is_multisite() || is_super_admin() )
     393                        echo '<span class="error-message">' . __('ERROR: the themes directory is either empty or doesn\'t exist. Please check your installation.') . '</span>';
     394        } elseif ( !empty($wp_registered_sidebars) ) {
    391395                $sidebars_widgets = wp_get_sidebars_widgets();
    392396                $num_widgets = 0;
    393397                foreach ( (array) $sidebars_widgets as $k => $v ) {
  • wp-includes/theme.php

     
    518518                return $theme;
    519519
    520520        $themes = get_themes();
    521         $theme_names = array_keys($themes);
    522         $current_template = get_option('template');
    523         $current_stylesheet = get_option('stylesheet');
    524521        $current_theme = 'Twenty Ten';
    525522
    526         if ( $themes ) {
     523        if ( $themes && is_array($themes) ) {
     524                $theme_names = array_keys($themes);
     525
    527526                foreach ( (array) $theme_names as $theme_name ) {
    528                         if ( $themes[$theme_name]['Stylesheet'] == $current_stylesheet &&
    529                                         $themes[$theme_name]['Template'] == $current_template ) {
     527                        if ( $themes[$theme_name]['Stylesheet'] == get_option('stylesheet') &&
     528                                        $themes[$theme_name]['Template'] == get_option('template') ) {
    530529                                $current_theme = $themes[$theme_name]['Name'];
    531530                                break;
    532531                        }