Make WordPress Core


Ignore:
Timestamp:
12/17/2010 09:53:47 PM (16 years ago)
Author:
ryan
Message:

Remove the delete action link from the network admin if the plugin is active on the main site. Remove the plugin(s) from the deletion list for the bulk actions and shows an error if no other plugin was selected for bulk-deletion. Props PeteMall. see #15709

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/plugins.php

    r17006 r17033  
    196196                        //$_POST = from the plugin form; $_GET = from the FTP details screen.
    197197                        $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
     198                        if ( empty( $plugins ) ) {
     199                                wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
     200                                exit;
     201                        }
     202
    198203                        $plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins.
    199                         if ( empty($plugins) ) {
    200                                 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
     204                        if ( empty( $plugins ) ) {
     205                                wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) );
    201206                                exit;
    202207                        }
     
    331336<?php if ( isset($_GET['error']) ) :
    332337
    333         if ( isset($_GET['charsout']) )
     338        if ( isset( $_GET['main'] ) )
     339                $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
     340        elseif ( isset($_GET['charsout']) )
    334341                $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation.  If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
    335342        else
     
    338345        <div id="message" class="updated"><p><?php echo $errmsg; ?></p>
    339346        <?php
    340                 if ( !isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
     347                if ( !isset( $_GET['main'] ) && !isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
    341348        <iframe style="border:0" width="100%" height="70px" src="<?php echo 'plugins.php?action=error_scrape&amp;plugin=' . esc_attr($plugin) . '&amp;_wpnonce=' . esc_attr($_GET['_error_nonce']); ?>"></iframe>
    342349        <?php
Note: See TracChangeset for help on using the changeset viewer.