mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-12 13:44:21 +01:00
Update all to eol-style: native, also fixes #1645
git-svn-id: http://svn.automattic.com/wordpress/trunk@3061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
fe1e8af589
commit
b7f5af4551
@ -6,6 +6,7 @@ $title = __('Users');
|
|||||||
$parent_file = 'profile.php';
|
$parent_file = 'profile.php';
|
||||||
|
|
||||||
$action = $_REQUEST['action'];
|
$action = $_REQUEST['action'];
|
||||||
|
$update = '';
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
|
|
||||||
@ -19,13 +20,20 @@ case 'promote':
|
|||||||
if ( !current_user_can('edit_users') )
|
if ( !current_user_can('edit_users') )
|
||||||
die(__('You can’t edit users.'));
|
die(__('You can’t edit users.'));
|
||||||
|
|
||||||
$userids = $_POST['users'];
|
$userids = $_POST['users'];
|
||||||
foreach($userids as $id) {
|
$update = 'promote';
|
||||||
$user = new WP_User($id);
|
foreach($userids as $id) {
|
||||||
$user->set_role($_POST['new_role']);
|
// The new role of the current user must also have edit_users caps
|
||||||
}
|
if($id == $current_user->id && !$wp_roles->role_objects[$_POST['new_role']]->has_cap('edit_users')) {
|
||||||
|
$update = 'err_admin_role';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
header('Location: users.php?update=promote');
|
$user = new WP_User($id);
|
||||||
|
$user->set_role($_POST['new_role']);
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: users.php?update=' . $update);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -33,7 +41,7 @@ case 'dodelete':
|
|||||||
|
|
||||||
check_admin_referer();
|
check_admin_referer();
|
||||||
|
|
||||||
if (empty($_POST['users'])) {
|
if ( empty($_POST['users']) ) {
|
||||||
header('Location: users.php');
|
header('Location: users.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,8 +50,13 @@ case 'dodelete':
|
|||||||
|
|
||||||
$userids = $_POST['users'];
|
$userids = $_POST['users'];
|
||||||
|
|
||||||
foreach($userids as $id) {
|
$update = 'del';
|
||||||
switch($_POST['delete_option']) {
|
foreach ($userids as $id) {
|
||||||
|
if($id == $current_user->id) {
|
||||||
|
$update = 'err_admin_del';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
switch($_POST['delete_option']) {
|
||||||
case 'delete':
|
case 'delete':
|
||||||
wp_delete_user($id);
|
wp_delete_user($id);
|
||||||
break;
|
break;
|
||||||
@ -53,7 +66,7 @@ case 'dodelete':
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: users.php?update=del');
|
header('Location: users.php?update=' . $update);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -74,26 +87,32 @@ case 'delete':
|
|||||||
?>
|
?>
|
||||||
<form action="" method="post" name="updateusers" id="updateusers">
|
<form action="" method="post" name="updateusers" id="updateusers">
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<h2><?php _e('Delete Users'); ?></h2>
|
<h2><?php _e('Delete Users'); ?></h2>
|
||||||
<p><?php _e('You have specified these users for deletion:'); ?></p>
|
<p><?php _e('You have specified these users for deletion:'); ?></p>
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php
|
||||||
foreach($userids as $id) {
|
$go_delete = false;
|
||||||
$user = new WP_User($id);
|
foreach ($userids as $id) {
|
||||||
echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />";
|
$user = new WP_User($id);
|
||||||
echo "{$id}: {$user->data->user_login}</li>\n";
|
if ($id == $current_user->id) {
|
||||||
}
|
echo "<li>" . sprintf('ID #%1s: %2s <strong>The current user will not be deleted.</strong>', $id, $user->data->user_login) . "</li>\n";
|
||||||
$all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login");
|
} else {
|
||||||
$user_dropdown = '<select name="reassign_user">';
|
echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf('ID #%1s: %2s', $id, $user->data->user_login) . "</li>\n";
|
||||||
foreach($all_logins as $login) {
|
$go_delete = true;
|
||||||
if(!in_array($login->ID, $userids)) {
|
|
||||||
$user_dropdown .= "<option value=\"{$login->ID}\">{$login->user_login}</option>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$user_dropdown .= '</select>';
|
$all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login");
|
||||||
?>
|
$user_dropdown = '<select name="reassign_user">';
|
||||||
</ul>
|
foreach ($all_logins as $login) {
|
||||||
<p><?php _e('What should be done with posts and links owned by this user?'); ?></p>
|
if ( $login->ID == $current_user->id || !in_array($login->ID, $userids) ) {
|
||||||
|
$user_dropdown .= "<option value=\"{$login->ID}\">{$login->user_login}</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user_dropdown .= '</select>';
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php if($go_delete) : ?>
|
||||||
|
<p><?php _e('What should be done with posts and links owned by this user?'); ?></p>
|
||||||
<ul style="list-style:none;">
|
<ul style="list-style:none;">
|
||||||
<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" checked="checked" />
|
<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" checked="checked" />
|
||||||
<?php _e('Delete all posts and links.'); ?></label></li>
|
<?php _e('Delete all posts and links.'); ?></label></li>
|
||||||
@ -102,6 +121,9 @@ case 'delete':
|
|||||||
</ul>
|
</ul>
|
||||||
<input type="hidden" name="action" value="dodelete" />
|
<input type="hidden" name="action" value="dodelete" />
|
||||||
<p class="submit"><input type="submit" name="submit" value="<?php _e('Confirm Deletion'); ?>" /></p>
|
<p class="submit"><input type="submit" name="submit" value="<?php _e('Confirm Deletion'); ?>" /></p>
|
||||||
|
<?php else : ?>
|
||||||
|
<p><?php _e('There are no valid users selected for deletion.'); ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
@ -151,6 +173,18 @@ default:
|
|||||||
<div id="message" class="updated fade"><p><?php _e('Changed roles.'); ?></p></div>
|
<div id="message" class="updated fade"><p><?php _e('Changed roles.'); ?></p></div>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
case 'err_admin_role':
|
||||||
|
?>
|
||||||
|
<div id="message" class="error"><p><?php _e("The current user's role must have user editing capabilities."); ?></p></div>
|
||||||
|
<div id="message" class="updated fade"><p><?php _e('Other user roles have been changed.'); ?></p></div>
|
||||||
|
<?php
|
||||||
|
break;
|
||||||
|
case 'err_admin_del':
|
||||||
|
?>
|
||||||
|
<div id="message" class="error"><p><?php _e("You can't delete the current user."); ?></p></div>
|
||||||
|
<div id="message" class="updated fade"><p><?php _e('Other users have been deleted.'); ?></p></div>
|
||||||
|
<?php
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
if ( isset($errors) ) : ?>
|
if ( isset($errors) ) : ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user