Fix bulk actions for Network Admin -> plugins. See #14435
git-svn-id: https://develop.svn.wordpress.org/trunk@16089 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f05e4fcd2b
commit
e76a5fe8b3
|
@ -253,21 +253,20 @@ class WP_Plugins_Table extends WP_List_Table {
|
||||||
global $status;
|
global $status;
|
||||||
|
|
||||||
$actions = array();
|
$actions = array();
|
||||||
if ( 'active' != $status )
|
|
||||||
$actions['activate-selected'] = __( 'Activate' );
|
if ( 'active' != $status ) {
|
||||||
if ( is_multisite() && 'network' != $status )
|
$action = is_network_admin() ? 'network-activate-selected' : 'activate-selected';
|
||||||
$actions['network-activate-selected'] = __( 'Network Activate' );
|
$actions[ $action ] = __( 'Activate' );
|
||||||
|
}
|
||||||
|
|
||||||
if ( 'inactive' != $status && 'recent' != $status )
|
if ( 'inactive' != $status && 'recent' != $status )
|
||||||
$actions['deactivate-selected'] = __( 'Deactivate' );
|
$actions['deactivate-selected'] = __( 'Deactivate' );
|
||||||
if ( current_user_can( 'update_plugins' ) )
|
|
||||||
$actions['update-selected'] = __( 'Update' );
|
if ( !is_multisite() || is_network_admin() ) {
|
||||||
if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) )
|
if ( current_user_can( 'update_plugins' ) )
|
||||||
$actions['delete-selected'] = __( 'Delete' );
|
$actions['update-selected'] = __( 'Update' );
|
||||||
|
if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) )
|
||||||
if ( is_multisite() && !is_network_admin() ) {
|
$actions['delete-selected'] = __( 'Delete' );
|
||||||
unset( $actions['network-activate-selected'] );
|
|
||||||
unset( $actions['update-selected'] );
|
|
||||||
unset( $actions['delete-selected'] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $actions;
|
return $actions;
|
||||||
|
@ -424,4 +423,4 @@ class WP_Plugins_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -63,7 +63,13 @@ if ( $action ) {
|
||||||
check_admin_referer('bulk-plugins');
|
check_admin_referer('bulk-plugins');
|
||||||
|
|
||||||
$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
|
$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
|
||||||
$plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); // Only activate plugins which are not already active.
|
|
||||||
|
// Only activate plugins which are not already active.
|
||||||
|
$check = $network_wide ? 'is_plugin_active_for_network' : 'is_plugin_active';
|
||||||
|
foreach ( $plugins as $i => $plugin )
|
||||||
|
if ( $check( $plugin ) )
|
||||||
|
unset( $plugins[ $i ] );
|
||||||
|
|
||||||
if ( empty($plugins) ) {
|
if ( empty($plugins) ) {
|
||||||
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
|
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
|
||||||
exit;
|
exit;
|
||||||
|
|
Loading…
Reference in New Issue