Make WordPress Core

Changeset 25666


Ignore:
Timestamp:
10/02/2013 08:49:59 PM (11 years ago)
Author:
nacin
Message:

Show a proper error message on the dashboard when the current theme is broken.

Clean up Appearance -> Themes when we don't have enough information to show for a broken theme.

Clean up broken/ugly "alt" row styling when we are displaying broken themes.

props johnbillion for initial patch.
fixes #21670.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/dashboard.php

    r25454 r25666  
    367367    if ( $theme->errors() ) {
    368368        if ( ! is_multisite() || is_super_admin() )
    369             echo '<span class="error-message">' . __('ERROR: The themes directory is either empty or doesn&#8217;t exist. Please check your installation.') . '</span>';
     369            echo '<span class="error-message">' . sprintf( __( 'ERROR: %s' ), $theme->errors()->get_error_message() ) . '</span>';
    370370    } elseif ( ! empty($wp_registered_sidebars) ) {
    371371        $sidebars_widgets = wp_get_sidebars_widgets();
  • trunk/src/wp-admin/themes.php

    r25616 r25666  
    139139        <?php echo $ct->display('Name'); ?>
    140140    </h4>
     141
     142<?php
     143if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
     144    echo '<p class="error-message">' . sprintf( __( 'ERROR: %s' ), $ct->errors()->get_error_message() ) . '</p>';
     145}
     146
     147// Certain error codes are less fatal than others. We can still display theme information in most cases.
     148if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() )
     149    && in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?>
    141150
    142151    <div>
     
    208217    ?>
    209218
     219<?php endif; // theme errors ?>
     220
    210221</div>
    211222
     
    293304    </tr>
    294305<?php
    295     $alt = '';
    296306    foreach ( $broken_themes as $broken_theme ) {
    297         $alt = ('class="alternate"' == $alt) ? '' : 'class="alternate"';
    298307        echo "
    299         <tr $alt>
     308        <tr>
    300309             <td>" . $broken_theme->get('Name') ."</td>
    301310             <td>" . $broken_theme->errors()->get_error_message() . "</td>
  • trunk/src/wp-includes/class-wp-theme.php

    r24583 r25666  
    207207            $this->headers['Name'] = $this->stylesheet;
    208208            if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet ) )
    209                 $this->errors = new WP_Error( 'theme_not_found', __( 'The theme directory does not exist.' ) );
     209                $this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), $this->stylesheet ) );
    210210            else
    211211                $this->errors = new WP_Error( 'theme_no_stylesheet', __( 'Stylesheet is missing.' ) );
Note: See TracChangeset for help on using the changeset viewer.