User management improvements from Mark Jaquith and David House. #2793

git-svn-id: http://svn.automattic.com/wordpress/trunk@3857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2006-06-08 18:36:05 +00:00
parent f124c51107
commit 5e7c850484
7 changed files with 310 additions and 141 deletions

View File

@@ -2,10 +2,13 @@
require_once('admin.php');
$title = __('Edit User');
$parent_file = 'profile.php';
if ( current_user_can('edit_users') )
$parent_file = 'users.php';
else
$parent_file = 'profile.php';
$submenu_file = 'users.php';
$wpvarstoreset = array('action', 'redirect', 'profile', 'user_id');
$wpvarstoreset = array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
@@ -21,6 +24,8 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
}
}
$wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
switch ($action) {
case 'switchposts':
@@ -40,7 +45,9 @@ else
$errors = edit_user($user_id);
if( !is_wp_error( $errors ) ) {
header("Location: user-edit.php?user_id=$user_id&updated=true");
$redirect = "user-edit.php?user_id=$user_id&updated=true";
$redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
header("Location: $redirect");
exit;
}
@@ -57,6 +64,9 @@ if ( !current_user_can('edit_user', $user_id) )
<?php if ( isset($_GET['updated']) ) : ?>
<div id="message" class="updated fade">
<p><strong><?php _e('User updated.') ?></strong></p>
<?php if ( $wp_http_referer ) : ?>
<p><a href="<?php echo wp_specialchars($wp_http_referer); ?>"><?php _e('&laquo; Back to Authors and Users'); ?></a></p>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ( is_wp_error( $errors ) ) : ?>
@@ -75,6 +85,9 @@ if ( !current_user_can('edit_user', $user_id) )
<form name="profile" id="your-profile" action="user-edit.php" method="post">
<?php wp_nonce_field('update-user_' . $user_id) ?>
<?php if ( $wp_http_referer ) : ?>
<input type="hidden" name="wp_http_referer" value="<?php echo wp_specialchars($wp_http_referer); ?>" />
<?php endif; ?>
<p>
<input type="hidden" name="from" value="profile" />
<input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />