WordPress.org

Make WordPress Core

Ticket #15707: 15707.patch

File 15707.patch, 2.1 KB (added by ocean90, 7 years ago)
  • wp-admin/includes/class-wp-ms-themes-list-table.php

     
    281281
    282282                if ( current_user_can('edit_themes') )
    283283                        $actions['edit'] = '<a href="theme-editor.php?theme=' . $theme['Name'] . '" title="' . __('Open this theme in the Theme Editor') . '" class="edit">' . __('Edit') . '</a>';
     284                       
     285                if ( empty( $theme['enabled'] ) && current_user_can( 'delete_themes' ) && ! $this->is_site_themes )
     286                        $actions['delete'] = '<a class="submitdelete deletion" href="' . wp_nonce_url( "themes.php?action=delete&amp;template=$theme_key", 'delete-theme_' . $theme_key ) . '" onclick="' . "return confirm( '" . esc_js( sprintf( __( "You are about to delete this theme '%s'.\nWarning: Other sites may be using that theme still!\n'Cancel' to stop, 'OK' to delete." ), $theme['Name'] ) ) . "' );" . '">' . __( 'Delete' ) . '</a>';
    284287
    285288                $actions = apply_filters( 'theme_action_links', array_filter( $actions ), $theme_key, $theme, $context );
    286289                $actions = apply_filters( "theme_action_links_$theme_key", $actions, $theme_key, $theme, $context );
  • wp-admin/network/themes.php

     
    5858                                unset( $allowed_themes[ $theme ] );
    5959                        update_site_option( 'allowedthemes', $allowed_themes );
    6060                        break;
     61                case 'delete':
     62                        check_admin_referer('delete-theme_' . $_GET['template']);
     63                        if ( !current_user_can('delete_themes') )
     64                                wp_die( __( 'Cheatin&#8217; uh?' ) );
     65                        delete_theme($_GET['template']);
     66                        wp_redirect( self_admin_url('themes.php?deleted=true') );
     67                        exit;
     68                        break;
    6169        }
    6270}
    6371
     
    8088
    8189require_once(ABSPATH . 'wp-admin/admin-header.php');
    8290
    83 ?>
     91if ( isset($_GET['deleted']) ) { ?>
     92<div class="updated"><p><?php _e('Theme deleted.') ?></p></div>
     93<?php } ?>
    8494
    8595<div class="wrap">
    8696<?php screen_icon('themes'); ?>