When deleting via User List Table, don't prompt for re-attribution if the user(s) do(es) not have any posts.
Props rajnikmit, wojtek.szkutnik, benjmay, wonderboymusic. Fixes #6405. Built from https://develop.svn.wordpress.org/trunk@34000 git-svn-id: http://core.svn.wordpress.org/trunk@33969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2762f019f7
commit
49b8ccec79
|
@ -446,3 +446,22 @@ function default_password_nag() {
|
||||||
printf( '<a href="%s" id="default-password-nag-no">' . __('No thanks, do not remind me again') . '</a>', '?default_password_nag=0' );
|
printf( '<a href="%s" id="default-password-nag-no">' . __('No thanks, do not remind me again') . '</a>', '?default_password_nag=0' );
|
||||||
echo '</p></div>';
|
echo '</p></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 3.5.0
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
function delete_users_add_js() { ?>
|
||||||
|
<script>
|
||||||
|
jQuery(document).ready( function($) {
|
||||||
|
var submit = $('#submit').prop('disabled', true);
|
||||||
|
$('input[name="delete_option"]').one('change', function() {
|
||||||
|
submit.prop('disabled', false);
|
||||||
|
});
|
||||||
|
$('#reassign_user').focus( function() {
|
||||||
|
$('#delete_option1').prop('checked', true).trigger('change');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
|
@ -80,25 +80,6 @@ if ( empty($_REQUEST) ) {
|
||||||
|
|
||||||
$update = '';
|
$update = '';
|
||||||
|
|
||||||
/**
|
|
||||||
* @since 3.5.0
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function delete_users_add_js() { ?>
|
|
||||||
<script>
|
|
||||||
jQuery(document).ready( function($) {
|
|
||||||
var submit = $('#submit').prop('disabled', true);
|
|
||||||
$('input[name=delete_option]').one('change', function() {
|
|
||||||
submit.prop('disabled', false);
|
|
||||||
});
|
|
||||||
$('#reassign_user').focus( function() {
|
|
||||||
$('#delete_option1').prop('checked', true).trigger('change');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ( $wp_list_table->current_action() ) {
|
switch ( $wp_list_table->current_action() ) {
|
||||||
|
|
||||||
/* Bulk Dropdown menu Role changes */
|
/* Bulk Dropdown menu Role changes */
|
||||||
|
@ -215,7 +196,15 @@ case 'delete':
|
||||||
else
|
else
|
||||||
$userids = array_map( 'intval', (array) $_REQUEST['users'] );
|
$userids = array_map( 'intval', (array) $_REQUEST['users'] );
|
||||||
|
|
||||||
|
$users_posts = new WP_Query( array(
|
||||||
|
'post_type' => 'any',
|
||||||
|
'author' => implode( ',', $userids ),
|
||||||
|
'posts_per_page' => 1
|
||||||
|
) );
|
||||||
|
|
||||||
|
if ( $users_posts->have_posts() ) {
|
||||||
add_action( 'admin_head', 'delete_users_add_js' );
|
add_action( 'admin_head', 'delete_users_add_js' );
|
||||||
|
}
|
||||||
|
|
||||||
include( ABSPATH . 'wp-admin/admin-header.php' );
|
include( ABSPATH . 'wp-admin/admin-header.php' );
|
||||||
?>
|
?>
|
||||||
|
@ -251,7 +240,11 @@ case 'delete':
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
<?php if ( $go_delete ) : ?>
|
<?php if ( $go_delete ) :
|
||||||
|
|
||||||
|
if ( ! $users_posts->have_posts() ) : ?>
|
||||||
|
<input type="hidden" name="delete_option" value="delete" />
|
||||||
|
<?php else: ?>
|
||||||
<?php if ( 1 == $go_delete ) : ?>
|
<?php if ( 1 == $go_delete ) : ?>
|
||||||
<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
|
<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
|
@ -264,7 +257,7 @@ case 'delete':
|
||||||
<?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
|
<?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
|
||||||
wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?></li>
|
wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?></li>
|
||||||
</ul></fieldset>
|
</ul></fieldset>
|
||||||
<?php
|
<?php endif;
|
||||||
/**
|
/**
|
||||||
* Fires at the end of the delete users form prior to the confirm button.
|
* Fires at the end of the delete users form prior to the confirm button.
|
||||||
*
|
*
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-33999';
|
$wp_version = '4.4-alpha-34000';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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