| | 138 | case 'remove': |
| | 139 | if ( !current_user_can('remove_users') ) |
| | 140 | die( __('You can’t remove users.') ); |
| | 141 | |
| | 142 | if ( empty($_REQUEST['users']) ) |
| | 143 | $userids = array( intval($_REQUEST['user']) ); |
| | 144 | else |
| | 145 | $userids = $_REQUEST['users']; |
| | 146 | |
| | 147 | require('../admin-header.php'); ?> |
| | 148 | <form action="" method="post" name="updateusers" id="updateusers"> |
| | 149 | <?php wp_nonce_field('remove-users') ?> |
| | 150 | |
| | 151 | <div class="wrap"> |
| | 152 | <?php screen_icon('users'); ?> |
| | 153 | <h2><?php printf( __('Remove Users from %s'), get_blogaddress_by_id($id) ); ?></h2> |
| | 154 | <p><?php _e('You have specified these users for removal:'); ?></p> |
| | 155 | <ul> |
| | 156 | <?php |
| | 157 | $go_remove = false; |
| | 158 | foreach ( $userids as $id ) { |
| | 159 | $id = (int) $id; |
| | 160 | $user = new WP_User($id); |
| | 161 | if ( $id == $current_user->id && !is_super_admin() ) { |
| | 162 | echo "<li>" . sprintf(__('ID #%1s: %2s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n"; |
| | 163 | } elseif ( !current_user_can('remove_user', $id) ) { |
| | 164 | echo "<li>" . sprintf(__('ID #%1s: %2s <strong>You don\'t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n"; |
| | 165 | } else { |
| | 166 | echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1s: %2s'), $id, $user->user_login) . "</li>\n"; |
| | 167 | $go_remove = true; |
| | 168 | } |
| | 169 | } |
| | 170 | ?> |
| | 171 | <?php if ( $go_remove ) : ?> |
| | 172 | <fieldset><p><legend><?php _e('What should be done with posts and links owned by this user?'); ?></legend></p> |
| | 173 | <ul style="list-style:none;"> |
| | 174 | <li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" checked="checked" /> |
| | 175 | <?php _e('Delete all posts and links.'); ?></label></li> |
| | 176 | <li><input type="radio" id="delete_option1" name="delete_option" value="reassign" /> |
| | 177 | <?php echo '<label for="delete_option1">'.__('Attribute all posts and links to:').'</label>'; |
| | 178 | wp_dropdown_users( array( 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?></li> |
| | 179 | </ul></fieldset> |
| | 180 | <input type="hidden" name="action" value="doremove" /> |
| | 181 | <?php submit_button( __('Confirm Removal'), 'secondary' ); ?> |
| | 182 | <?php else : ?> |
| | 183 | <p><?php _e('There are no valid users selected for removal.'); ?></p> |
| | 184 | <?php endif; ?> |
| | 185 | </div> |
| | 186 | </form><?php |
| | 187 | require('../admin-footer.php'); |
| | 188 | exit(); |
| | 189 | break; |
| | 190 | |