WordPress.org

Make WordPress Core

Ticket #32668: 32668-1.diff

File 32668-1.diff, 1.5 KB (added by rabmalin, 4 years ago)
  • themes.php

     
    274274
    275275<?php
    276276$can_delete = current_user_can( 'delete_themes' );
     277$can_install = current_user_can( 'install_themes' );
    277278?>
    278279<table>
    279280        <tr>
     
    287288        <?php foreach ( $broken_themes as $broken_theme ) : ?>
    288289                <tr>
    289290                        <td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : $broken_theme->get_stylesheet(); ?></td>
    290                         <td><?php echo $broken_theme->errors()->get_error_message(); ?></td>
     291                        <td>
     292        <?php echo $broken_theme->errors()->get_error_message(); ?>
     293        <?php
     294        $parent_theme_name = $broken_theme->get( 'Template' );
     295        $parent_theme = themes_api( 'theme_information', array( 'slug' => urlencode( $parent_theme_name ) ) );
     296        if ( $can_install && ! is_wp_error( $parent_theme ) ) {
     297          $install_url = add_query_arg( array(
     298            'action' => 'install-theme',
     299            'theme'  => urlencode( $parent_theme_name ),
     300          ), admin_url( 'update.php' ) );
     301          $install_url = wp_nonce_url( $install_url, 'install-theme_' . $parent_theme_name );
     302          ?>
     303          <br /><a href="<?php echo esc_url( $install_url ); ?>" class="button button-secondary"><?php _e( 'Install Parent Theme' ); ?></a>
     304          <?php
     305        }
     306        ?>
     307      </td>
    291308                        <?php
    292309                        if ( $can_delete ) {
    293310                                $stylesheet = $broken_theme->get_stylesheet();