Make WordPress Core

Changeset 16089


Ignore:
Timestamp:
10/29/2010 07:09:04 PM (14 years ago)
Author:
scribu
Message:

Fix bulk actions for Network Admin -> plugins. See #14435

Location:
trunk/wp-admin
Files:
2 edited

Legend:

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

    r16061 r16089  
    254254
    255255        $actions = array();
    256         if ( 'active' != $status )
    257             $actions['activate-selected'] = __( 'Activate' );
    258         if ( is_multisite() && 'network' != $status )
    259             $actions['network-activate-selected'] = __( 'Network Activate' );
     256
     257        if ( 'active' != $status ) {
     258            $action = is_network_admin() ? 'network-activate-selected' : 'activate-selected';
     259            $actions[ $action ] = __( 'Activate' );
     260        }
     261
    260262        if ( 'inactive' != $status && 'recent' != $status )
    261263            $actions['deactivate-selected'] = __( 'Deactivate' );
    262         if ( current_user_can( 'update_plugins' ) )
    263             $actions['update-selected'] = __( 'Update' );
    264         if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) )
    265             $actions['delete-selected'] = __( 'Delete' );
    266            
    267         if ( is_multisite() && !is_network_admin() ) {
    268             unset( $actions['network-activate-selected'] );
    269             unset( $actions['update-selected'] );
    270             unset( $actions['delete-selected'] );
     264
     265        if ( !is_multisite() || is_network_admin() ) {
     266            if ( current_user_can( 'update_plugins' ) )
     267                $actions['update-selected'] = __( 'Update' );
     268            if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) )
     269                $actions['delete-selected'] = __( 'Delete' );
    271270        }
    272271
  • trunk/wp-admin/plugins.php

    r16061 r16089  
    6464
    6565            $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
    66             $plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); // Only activate plugins which are not already active.
     66
     67            // Only activate plugins which are not already active.
     68            $check = $network_wide ? 'is_plugin_active_for_network' : 'is_plugin_active';
     69            foreach ( $plugins as $i => $plugin )
     70                if ( $check( $plugin ) )
     71                    unset( $plugins[ $i ] );
     72
    6773            if ( empty($plugins) ) {
    6874                wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
Note: See TracChangeset for help on using the changeset viewer.