From ece19d2bfb761aae71b3ff146c775ee9c870ce07 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 31 Jan 2008 21:44:17 +0000 Subject: [PATCH] Merge user-edit.php and profile.php. Props nbachiyski. fixes #5736 git-svn-id: http://svn.automattic.com/wordpress/trunk@6697 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/profile.php | 198 +---------------------------------- wp-admin/user-edit.php | 115 +++++++++++++++++--- wp-includes/capabilities.php | 4 +- 3 files changed, 103 insertions(+), 214 deletions(-) diff --git a/wp-admin/profile.php b/wp-admin/profile.php index 2beb29ceb6..031ca6b2ac 100644 --- a/wp-admin/profile.php +++ b/wp-admin/profile.php @@ -1,198 +1,4 @@ - - - - -
-

-
- - -
-

-
- -

- - -

- -

- - -

- - - - -

- -
- -

- -

- -

- -

- -

-
- -
- - -

- -

- -

- -

- -

-

-
-
-
- -

-

-
- - -
- -

-

-

-

-
-

-
- - - - -
- - - caps) > count($profileuser->roles)): - ?> - - - - - -
caps as $cap => $value) { - if(!$wp_roles->is_role($cap)) { - if($output != '') $output .= ', '; - $output .= $value ? $cap : "Denied: {$cap}"; - } - } - echo $output; - ?>
-

-
- -
- - diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index 270619a3ea..7365d15cc7 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -1,8 +1,57 @@ + +ID; + } else { + wp_die(__('Invalid user ID.')); + } switch ($action) { case 'switchposts': @@ -33,10 +87,14 @@ check_admin_referer('update-user_' . $user_id); if ( !current_user_can('edit_user', $user_id) ) wp_die(__('You do not have permission to edit this user.')); +if ( $is_profile_page ) { + do_action('personal_options_update'); +} + $errors = edit_user($user_id); if( !is_wp_error( $errors ) ) { - $redirect = "user-edit.php?user_id=$user_id&updated=true"; + $redirect = ($is_profile_page? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true"; $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect); wp_redirect($redirect); exit; @@ -54,7 +112,7 @@ include ('admin-header.php');

- +

@@ -71,9 +129,9 @@ include ('admin-header.php');
-

+

-
+ @@ -83,16 +141,27 @@ include ('admin-header.php');

-

+

-

+ +

+ + + + +

+

+

@@ -168,7 +238,7 @@ echo $role_list . '';

- +

@@ -178,18 +248,29 @@ $show_password_fields = apply_filters('show_password_fields', true); if ( $show_password_fields ) : ?>
- -

+ +

+ +

+
+

+
- +
@@ -216,7 +297,7 @@ if ( $show_password_fields ) :

- +

diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index 40527c764c..85eaa7735e 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -290,7 +290,9 @@ function map_meta_cap($cap, $user_id) { $caps[] = 'delete_users'; break; case 'edit_user': - $caps[] = 'edit_users'; + if ( !isset($args[0]) || $user_id != $args[0] ) { + $caps[] = 'edit_users'; + } break; case 'delete_post': $author_data = get_userdata($user_id);