Networks and Sites: Introduce an AYS when bulk deleting sites from the Sites screen in Network Admin.
Props flixos90, MaximeCulea Fixes #41177 Built from https://develop.svn.wordpress.org/trunk@41131 git-svn-id: http://core.svn.wordpress.org/trunk@40971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
06e6edbd61
commit
d8151e9dd1
|
@ -132,6 +132,28 @@ if ( isset( $_GET['action'] ) ) {
|
||||||
}
|
}
|
||||||
break;
|
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':
|
case 'allblogs':
|
||||||
if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) {
|
if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) {
|
||||||
$doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
|
$doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
|
||||||
|
@ -140,11 +162,32 @@ if ( isset( $_GET['action'] ) ) {
|
||||||
if ( $val != '0' && $val != get_network()->site_id ) {
|
if ( $val != '0' && $val != get_network()->site_id ) {
|
||||||
switch ( $doaction ) {
|
switch ( $doaction ) {
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if ( ! current_user_can( 'delete_site', $val ) )
|
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||||
wp_die( __( 'Sorry, you are not allowed to delete the site.' ) );
|
?>
|
||||||
|
<div class="wrap">
|
||||||
$updated_action = 'all_delete';
|
<h1><?php _e( 'Confirm your action' ); ?></h1>
|
||||||
wpmu_delete_blog( $val, true );
|
<form action="sites.php?action=delete_sites" method="post">
|
||||||
|
<input type="hidden" name="action" value="delete_sites" />
|
||||||
|
<input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" />
|
||||||
|
<?php wp_nonce_field( 'ms-delete-sites', '_wpnonce', false ); ?>
|
||||||
|
<p><?php _e( 'You are about to delete the following sites:' ); ?></p>
|
||||||
|
<ul class="ul-disc">
|
||||||
|
<?php foreach ( $_POST['allblogs'] as $site_id ) :
|
||||||
|
$site = get_site( $site_id );
|
||||||
|
$site_address = untrailingslashit( $site->domain . $site->path );
|
||||||
|
?>
|
||||||
|
<li>
|
||||||
|
<?php echo $site_address; ?>
|
||||||
|
<input type="hidden" name="site_ids[]" value="<?php echo (int) $site_id; ?>" />
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php submit_button( __( 'Confirm' ), 'primary' ); ?>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
require_once( ABSPATH . 'wp-admin/admin-footer.php' );
|
||||||
|
exit();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'spam':
|
case 'spam':
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.9-alpha-41127';
|
$wp_version = '4.9-alpha-41131';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue