From 0fdf7fdebfe0a7b57761d15ad1702e6826e63fd4 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 24 Jul 2017 22:40:12 +0000 Subject: [PATCH] Networks and Sites: Introduce an AYS when bulk deleting sites from the Sites screen in Network Admin. Props flixos90, MaximeCulea Fixes #41177 git-svn-id: https://develop.svn.wordpress.org/trunk@41131 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/network/sites.php | 53 ++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/network/sites.php b/src/wp-admin/network/sites.php index a0ec407cfc..0437ee9912 100644 --- a/src/wp-admin/network/sites.php +++ b/src/wp-admin/network/sites.php @@ -132,6 +132,28 @@ if ( isset( $_GET['action'] ) ) { } break; + case 'delete_sites': + check_admin_referer( 'ms-delete-sites' ); + + foreach ( (array) $_POST['site_ids'] as $site_id ) { + $site_id = (int) $site_id; + + if ( $site_id == get_network()->site_id ) { + continue; + } + + if ( ! current_user_can( 'delete_site', $site_id ) ) { + $site = get_site( $site_id ); + $site_address = untrailingslashit( $site->domain . $site->path ); + + wp_die( sprintf( __( 'Sorry, you are not allowed to delete the site %s.' ), $site_address ), 403 ); + } + + $updated_action = 'all_delete'; + wpmu_delete_blog( $site_id, true ); + } + break; + case 'allblogs': if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) { $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; @@ -140,11 +162,32 @@ if ( isset( $_GET['action'] ) ) { if ( $val != '0' && $val != get_network()->site_id ) { switch ( $doaction ) { case 'delete': - if ( ! current_user_can( 'delete_site', $val ) ) - wp_die( __( 'Sorry, you are not allowed to delete the site.' ) ); - - $updated_action = 'all_delete'; - wpmu_delete_blog( $val, true ); + require_once( ABSPATH . 'wp-admin/admin-header.php' ); + ?> +
+

+
+ + + +

+
    + domain . $site->path ); + ?> +
  • + + +
  • + +
+ +
+
+