Ticket #12386: ms_confirm_delete.diff
File ms_confirm_delete.diff, 2.8 KB (added by , 15 years ago) |
---|
-
includes/ms.php
166 166 function confirm_delete_users( $users ) { 167 167 if ( !is_array( $users ) ) 168 168 return false; 169 170 echo '<p>' . __( 'Transfer posts before deleting users:' ) . '</p>'; 171 172 echo '<form action="ms-edit.php?action=allusers" method="post">'; 173 echo '<input type="hidden" name="alluser_transfer_delete" />'; 169 170 screen_icon('tools'); 171 ?> 172 <h2><?php esc_html_e('Users'); ?></h2> 173 <p><?php _e( 'Transfer posts before deleting users:' ); ?></p> 174 <form action="ms-edit.php?action=allusers" method="post"> 175 <input type="hidden" name="alluser_transfer_delete" /> 176 <?php 174 177 wp_nonce_field( 'allusers' ); 175 178 foreach ( (array) $_POST['allusers'] as $key => $val ) { 176 179 if ( $val != '' && $val != '0' ) { 180 $allusers[] = $val; 177 181 $user = new WP_User( $val ); 182 178 183 if ( in_array( $user->user_login, get_site_option( 'site_admins', array( 'admin' ) ) ) ) 179 184 wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a site admnistrator.' ), $user->user_login ) ); 185 180 186 echo "<input type='hidden' name='user[]' value='{$val}'/>\n"; 181 187 $blogs = get_blogs_of_user( $val, true ); 188 182 189 if ( !empty( $blogs ) ) { 183 190 foreach ( (array) $blogs as $key => $details ) { 184 191 $blog_users = get_users_of_blog( $details->userblog_id ); … … 187 194 echo "<select name='blog[$val][{$key}]'>"; 188 195 $out = ''; 189 196 foreach ( $blog_users as $user ) { 190 if ( $user->user_id != $val )197 if ( $user->user_id != $val && !in_array( $val, $allusers ) ) 191 198 $out .= "<option value='{$user->user_id}'>{$user->user_login}</option>"; 192 199 } 193 200 if ( $out == '' ) 194 $out = "<option value='1'>admin</option>";201 $out = '<option value="1">admin</option>'; // todo: change, because admin is fix 195 202 echo $out; 196 203 echo "</select>\n"; 197 204 } … … 199 206 } 200 207 } 201 208 } 202 echo "<br /><input type='submit' value='" . __( 'Delete user and transfer posts' ) . "' />"; 203 echo "</form>"; 209 ?> 210 <br class="clear" /> 211 <input type="submit" class="button-secondary delete" value="<?php _e( 'Delete user and transfer posts' ); ?> " /> 212 </form> 213 <?php 204 214 return true; 205 215 } 206 216 -
ms-edit.php
465 465 echo '<div class="wrap" style="position:relative;">'; 466 466 confirm_delete_users( $_POST['allusers'] ); 467 467 echo '</div>'; 468 require_once('admin-footer.php'); 468 469 } elseif ( isset( $_POST[ 'alluser_transfer_delete' ] ) ) { 469 470 if ( is_array( $_POST[ 'blog' ] ) && !empty( $_POST[ 'blog' ] ) ) { 470 471 foreach ( $_POST[ 'blog' ] as $id => $users ) {