Make WordPress Core

Ticket #6405: 6405.2.diff

File 6405.2.diff, 3.0 KB (added by benjmay, 9 years ago)

Updated to work with changes in 4.3

  • wp-admin/users.php

    diff --git wp-admin/users.php wp-admin/users.php
    index df7648b..4f04f06 100644
    $update = ''; 
    8282function delete_users_add_js() { ?>
    8383<script>
    8484jQuery(document).ready( function($) {
    85         var submit = $('#submit').prop('disabled', true);
    86         $('input[name=delete_option]').one('change', function() {
    87                 submit.prop('disabled', false);
    88         });
    89         $('#reassign_user').focus( function() {
    90                 $('#delete_option1').prop('checked', true).trigger('change');
    91         });
     85        if( $('#delete_option_hidden').length == 0 ) {
     86                var submit = $('#submit').prop('disabled', true);
     87                $('input[name=delete_option]').one('change', function() {
     88                        submit.prop('disabled', false);
     89                });
     90                $('#reassign_user').focus( function() {
     91                        $('#delete_option1').prop('checked', true).trigger('change');
     92                });
    9293});
    9394</script>
    9495<?php
    case 'delete': 
    207208
    208209        add_action( 'admin_head', 'delete_users_add_js' );
    209210
     211        $users_posts = new WP_Query( array( 'post_type' => 'any', 'author' => implode( ',', $userids ) ) );
     212
    210213        include( ABSPATH . 'wp-admin/admin-header.php' );
    211214?>
    212215<form method="post" name="updateusers" id="updateusers">
    case 'delete': 
    242245        ?>
    243246        </ul>
    244247<?php if ( $go_delete ) : ?>
    245         <?php if ( 1 == $go_delete ) : ?>
    246                 <fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
    247         <?php else : ?>
    248                 <fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p>
     248        <?php if( ! $users_posts->have_posts() ) : ?>
     249                <input type="hidden" id="delete_option_hidden" name="delete_option" value="delete" />
     250  <?php else: ?>
     251                <?php if ( 1 == $go_delete ) : ?>
     252                        <fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
     253                <?php else : ?>
     254                        <fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p>
     255                <?php endif; ?>
     256                <ul style="list-style:none;">
     257                        <li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" />
     258                        <?php _e('Delete all content.'); ?></label></li>
     259                        <li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
     260                        <?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
     261                        wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?></li>
     262                </ul></fieldset>
    249263        <?php endif; ?>
    250         <ul style="list-style:none;">
    251                 <li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" />
    252                 <?php _e('Delete all content.'); ?></label></li>
    253                 <li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
    254                 <?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
    255                 wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?></li>
    256         </ul></fieldset>
    257264        <?php
    258265        /**
    259266         * Fires at the end of the delete users form prior to the confirm button.