Changeset 31656
- Timestamp:
- 03/07/2015 04:39:13 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/network/users.php
r31517 r31656 19 19 function confirm_delete_users( $users ) { 20 20 $current_user = wp_get_current_user(); 21 if ( ! is_array( $users ) )21 if ( ! is_array( $users ) || empty( $users ) ) { 22 22 return false; 23 } 23 24 ?> 24 25 <h2><?php esc_html_e( 'Users' ); ?></h2> 25 <p><?php _e( 'Transfer or delete content before deleting users.' ); ?></p> 26 27 <?php if ( count( $users ) > 1 ) : ?> 28 <p><?php _e( 'You have chosen to delete the following users from all networks and sites.' ); ?></p> 29 <?php else : ?> 30 <p><?php _e( 'You have chosen to delete the user from all networks and sites.' ); ?></p> 31 <?php endif; ?> 32 26 33 <form action="users.php?action=dodelete" method="post"> 27 34 <input type="hidden" name="dodelete" /> … … 29 36 wp_nonce_field( 'ms-users-delete' ); 30 37 $site_admins = get_super_admins(); 31 $admin_out = '<option value="' . $current_user->ID . '">' . $current_user->user_login . '</option>';32 33 foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) {38 $admin_out = '<option value="' . esc_attr( $current_user->ID ) . '">' . $current_user->user_login . '</option>'; ?> 39 <table class="form-table"> 40 <?php foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) { 34 41 if ( $user_id != '' && $user_id != '0' ) { 35 42 $delete_user = get_userdata( $user_id ); 36 43 37 if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) 44 if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) { 38 45 wp_die( sprintf( __( 'Warning! User %s cannot be deleted.' ), $delete_user->user_login ) ); 39 40 if ( in_array( $delete_user->user_login, $site_admins ) ) 41 wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network administrator.' ), $delete_user->user_login ) ); 42 43 echo "<input type='hidden' name='user[]' value='{$user_id}'/>\n"; 44 $blogs = get_blogs_of_user( $user_id, true ); 45 46 if ( !empty( $blogs ) ) { 46 } 47 48 if ( in_array( $delete_user->user_login, $site_admins ) ) { 49 wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network administrator.' ), '<em>' . $delete_user->user_login . '</em>' ) ); 50 } 51 ?> 52 <tr> 53 <th scope="row"><?php echo $delete_user->user_login; ?> 54 <?php echo '<input type="hidden" name="user[]" value="' . esc_attr( $user_id ) . '" />' . "\n"; ?> 55 </th> 56 <?php $blogs = get_blogs_of_user( $user_id, true ); 57 58 if ( ! empty( $blogs ) ) { 47 59 ?> 48 < br /><fieldset><p><legend><?php printf( __( "What should be done with content owned by %s?"), '<em>' . $delete_user->user_login . '</em>' ); ?></legend></p>60 <td><fieldset><p><legend><?php printf( __( 'What should be done with content owned by %s?' ), '<em>' . $delete_user->user_login . '</em>' ); ?></legend></p> 49 61 <?php 50 62 foreach ( (array) $blogs as $key => $details ) { … … 56 68 $user_list = ''; 57 69 foreach ( $blog_users as $user ) { 58 if ( ! in_array( $user->ID, $allusers ) ) 70 if ( ! in_array( $user->ID, $allusers ) ) { 59 71 $user_list .= "<option value='{$user->ID}'>{$user->user_login}</option>"; 72 } 60 73 } 61 if ( '' == $user_list ) 74 if ( '' == $user_list ) { 62 75 $user_list = $admin_out; 76 } 63 77 $user_dropdown .= $user_list; 64 78 $user_dropdown .= "</select>\n"; … … 74 88 } 75 89 } 76 echo "</fieldset>"; 77 } 90 echo "</fieldset></td></tr>"; 91 } else { 92 ?> 93 <td><fieldset><p><legend><?php _e( 'User has no sites or content and will be deleted.' ); ?></legend></p> 94 <?php } ?> 95 </tr> 96 <?php 78 97 } 79 98 } 80 99 100 ?> 101 </table> 102 <?php 81 103 /** This action is documented in wp-admin/users.php */ 82 104 do_action( 'delete_user_form', $current_user ); 83 105 106 if ( count( $users ) > 1 ) : ?> 107 <p><?php _e( 'Once you hit “Confirm Deletion”, these users will be permanently removed.' ); ?></p> 108 <?php else : ?> 109 <p><?php _e( 'Once you hit “Confirm Deletion”, the user will be permanently removed.' ); ?></p> 110 <?php endif; 111 84 112 submit_button( __('Confirm Deletion'), 'delete' ); 85 113 ?>
Note: See TracChangeset
for help on using the changeset viewer.