Changeset 3061
- Timestamp:
- 11/13/2005 04:40:18 AM (19 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-db.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/wp-admin/edit-form-ajax-cat.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/wp-admin/edit-link-form.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/wp-admin/execute-pings.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/wp-admin/import.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/wp-admin/inline-uploading.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/wp-admin/list-manipulation.js
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/wp-admin/list-manipulation.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/wp-admin/users.php
r2872 r3061 7 7 8 8 $action = $_REQUEST['action']; 9 $update = ''; 9 10 10 11 switch ($action) { … … 20 21 die(__('You can’t edit users.')); 21 22 22 $userids = $_POST['users']; 23 foreach($userids as $id) { 24 $user = new WP_User($id); 25 $user->set_role($_POST['new_role']); 26 } 23 $userids = $_POST['users']; 24 $update = 'promote'; 25 foreach($userids as $id) { 26 // The new role of the current user must also have edit_users caps 27 if($id == $current_user->id && !$wp_roles->role_objects[$_POST['new_role']]->has_cap('edit_users')) { 28 $update = 'err_admin_role'; 29 continue; 30 } 31 32 $user = new WP_User($id); 33 $user->set_role($_POST['new_role']); 34 } 27 35 28 header('Location: users.php?update= promote');36 header('Location: users.php?update=' . $update); 29 37 30 38 break; … … 34 42 check_admin_referer(); 35 43 36 if ( empty($_POST['users'])) {44 if ( empty($_POST['users']) ) { 37 45 header('Location: users.php'); 38 46 } … … 43 51 $userids = $_POST['users']; 44 52 45 foreach($userids as $id) { 46 switch($_POST['delete_option']) { 53 $update = 'del'; 54 foreach ($userids as $id) { 55 if($id == $current_user->id) { 56 $update = 'err_admin_del'; 57 continue; 58 } 59 switch($_POST['delete_option']) { 47 60 case 'delete': 48 61 wp_delete_user($id); … … 54 67 } 55 68 56 header('Location: users.php?update= del');69 header('Location: users.php?update=' . $update); 57 70 58 71 break; … … 75 88 <form action="" method="post" name="updateusers" id="updateusers"> 76 89 <div class="wrap"> 77 <h2><?php _e('Delete Users'); ?></h2> 78 <p><?php _e('You have specified these users for deletion:'); ?></p> 79 <ul> 80 <?php 81 foreach($userids as $id) { 82 $user = new WP_User($id); 83 echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />"; 84 echo "{$id}: {$user->data->user_login}</li>\n"; 85 } 86 $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login"); 87 $user_dropdown = '<select name="reassign_user">'; 88 foreach($all_logins as $login) { 89 if(!in_array($login->ID, $userids)) { 90 $user_dropdown .= "<option value=\"{$login->ID}\">{$login->user_login}</option>"; 91 } 92 } 93 $user_dropdown .= '</select>'; 94 ?> 95 </ul> 96 <p><?php _e('What should be done with posts and links owned by this user?'); ?></p> 90 <h2><?php _e('Delete Users'); ?></h2> 91 <p><?php _e('You have specified these users for deletion:'); ?></p> 92 <ul> 93 <?php 94 $go_delete = false; 95 foreach ($userids as $id) { 96 $user = new WP_User($id); 97 if ($id == $current_user->id) { 98 echo "<li>" . sprintf('ID #%1s: %2s <strong>The current user will not be deleted.</strong>', $id, $user->data->user_login) . "</li>\n"; 99 } else { 100 echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf('ID #%1s: %2s', $id, $user->data->user_login) . "</li>\n"; 101 $go_delete = true; 102 } 103 } 104 $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login"); 105 $user_dropdown = '<select name="reassign_user">'; 106 foreach ($all_logins as $login) { 107 if ( $login->ID == $current_user->id || !in_array($login->ID, $userids) ) { 108 $user_dropdown .= "<option value=\"{$login->ID}\">{$login->user_login}</option>"; 109 } 110 } 111 $user_dropdown .= '</select>'; 112 ?> 113 </ul> 114 <?php if($go_delete) : ?> 115 <p><?php _e('What should be done with posts and links owned by this user?'); ?></p> 97 116 <ul style="list-style:none;"> 98 117 <li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" checked="checked" /> … … 103 122 <input type="hidden" name="action" value="dodelete" /> 104 123 <p class="submit"><input type="submit" name="submit" value="<?php _e('Confirm Deletion'); ?>" /></p> 124 <?php else : ?> 125 <p><?php _e('There are no valid users selected for deletion.'); ?></p> 126 <?php endif; ?> 105 127 </div> 106 128 </form> … … 150 172 ?> 151 173 <div id="message" class="updated fade"><p><?php _e('Changed roles.'); ?></p></div> 174 <?php 175 break; 176 case 'err_admin_role': 177 ?> 178 <div id="message" class="error"><p><?php _e("The current user's role must have user editing capabilities."); ?></p></div> 179 <div id="message" class="updated fade"><p><?php _e('Other user roles have been changed.'); ?></p></div> 180 <?php 181 break; 182 case 'err_admin_del': 183 ?> 184 <div id="message" class="error"><p><?php _e("You can't delete the current user."); ?></p></div> 185 <div id="message" class="updated fade"><p><?php _e('Other users have been deleted.'); ?></p></div> 152 186 <?php 153 187 break;
Note: See TracChangeset
for help on using the changeset viewer.