WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/02/2010 06:10:43 PM (9 years ago)
Author:
ryan
Message:

Move confirm_delete_users() to edit.php. Update links in edit.php. see #14435

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ms.php

    r15487 r15488  
    175175    do_action( 'deleted_user', $id );
    176176
    177     return true;
    178 }
    179 
    180 function confirm_delete_users( $users ) {
    181     $current_user = wp_get_current_user();
    182     if ( !is_array( $users ) )
    183         return false;
    184 
    185     screen_icon();
    186     ?>
    187     <h2><?php esc_html_e( 'Users' ); ?></h2>
    188     <p><?php _e( 'Transfer or delete posts and links before deleting users.' ); ?></p>
    189     <form action="ms-edit.php?action=dodelete" method="post">
    190     <input type="hidden" name="dodelete" />
    191     <?php
    192     wp_nonce_field( 'ms-users-delete' );
    193     $site_admins = get_super_admins();
    194     $admin_out = "<option value='$current_user->ID'>$current_user->user_login</option>";
    195 
    196     foreach ( ( $allusers = (array) $_POST['allusers'] ) as $key => $val ) {
    197         if ( $val != '' && $val != '0' ) {
    198             $delete_user = new WP_User( $val );
    199 
    200             if ( in_array( $delete_user->user_login, $site_admins ) )
    201                 wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network admnistrator.' ), $delete_user->user_login ) );
    202 
    203             echo "<input type='hidden' name='user[]' value='{$val}'/>\n";
    204             $blogs = get_blogs_of_user( $val, true );
    205 
    206             if ( !empty( $blogs ) ) {
    207                 ?>
    208                 <br /><fieldset><p><legend><?php printf( __( "What should be done with posts and links owned by <em>%s</em>?" ), $delete_user->user_login ); ?></legend></p>
    209                 <?php
    210                 foreach ( (array) $blogs as $key => $details ) {
    211                     $blog_users = get_users_of_blog( $details->userblog_id );
    212                     if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
    213                         $user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
    214                         $user_dropdown = "<select name='blog[$val][{$key}]'>";
    215                         $user_list = '';
    216                         foreach ( $blog_users as $user ) {
    217                             if ( $user->user_id != $val && !in_array( $user->user_id, $allusers ) )
    218                                 $user_list .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
    219                         }
    220                         if ( '' == $user_list )
    221                             $user_list = $admin_out;
    222                         $user_dropdown .= $user_list;
    223                         $user_dropdown .= "</select>\n";
    224                         ?>
    225                         <ul style="list-style:none;">
    226                             <li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>
    227                             <li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />
    228                             <?php _e( 'Delete all posts and links.' ); ?></label></li>
    229                             <li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />
    230                             <?php echo __( 'Attribute all posts and links to:' ) . '</label>' . $user_dropdown; ?></li>
    231                         </ul>
    232                         <?php
    233                     }
    234                 }
    235                 echo "</fieldset>";
    236             }
    237         }
    238     }
    239     ?>
    240     <p class="submit"><input type="submit" class="button-secondary delete" value="<?php esc_attr_e( 'Confirm Deletion' ); ?>" /></p>
    241     </form>
    242     <?php
    243177    return true;
    244178}
Note: See TracChangeset for help on using the changeset viewer.