X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/11be8dc178e77d0b46189bbd8e33a216a9b90942..312084b5d95c21feb519ff03decf948420e1f6fa:/wp-admin/user-edit.php diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index 0cedd29c..b3ecb63a 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -9,76 +9,14 @@ /** WordPress Administration Bootstrap */ require_once('admin.php'); -if ( defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE ) - $is_profile_page = true; -else - $is_profile_page = false; - -/** - * Display JavaScript for profile page. - * - * @since 2.5.0 - */ -function profile_js ( ) { -?> - -ID; } else { @@ -101,6 +39,11 @@ if ( !$user_id ) { wp_die( __('Invalid user ID.') ); } +$all_post_caps = array('posts', 'pages'); +$user_can_edit = false; +foreach ( $all_post_caps as $post_cap ) + $user_can_edit |= current_user_can("edit_$post_cap"); + /** * Optional SSL preference that can be turned on by hooking to the 'personal_options' action. * @@ -133,15 +76,15 @@ 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'); +if ( IS_PROFILE_PAGE ) + do_action('personal_options_update', $user_id); else - do_action('edit_user_profile_update'); + do_action('edit_user_profile_update', $user_id); $errors = edit_user($user_id); if ( !is_wp_error( $errors ) ) { - $redirect = ($is_profile_page? "profile.php?" : "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; @@ -159,7 +102,7 @@ include ('admin-header.php');

- +

@@ -177,12 +120,12 @@ include ('admin-header.php');
-

+

-
+ - +

@@ -192,7 +135,7 @@ include ('admin-header.php');

- + @@ -201,13 +144,13 @@ include ('admin-header.php'); 1 ) : ?> -
+
$color_info ): ?> -
/> +
/> colors as $html_color ): ?> @@ -221,17 +164,19 @@ foreach ( $_wp_admin_css_colors as $color => $color_info ): ?> + - +
More information'); ?>
@@ -240,65 +185,67 @@ do_action('personal_options', $profileuser); - + - + +'; + echo ''; ?> - + + - + - + - - + + - + ';
'; -$role_list = ''; -$user_has_role = false; -foreach($wp_roles->role_names as $role => $name) { - $name = translate_with_context($name); - if ( $profileuser->has_cap($role) ) { - $selected = ' selected="selected"'; - $user_has_role = true; - } else { - $selected = ''; - } - $role_list .= ""; -} -if ( $user_has_role ) - $role_list .= ''; +// Get the highest/primary role for this user +// TODO: create a function that does this: wp_get_user_role() +$user_roles = $profileuser->roles; +$user_role = array_shift($user_roles); + +// print the full list of roles with the primary one selected. +wp_dropdown_roles($user_role); + +// print the 'no role' option. Make it selected if the user has no role yet. +if ( $user_role ) + echo ''; else - $role_list .= ''; -echo $role_list . '
- - + + - - - - - - - - - - - + + $desc) { +?> - - + + +
-

+

- + - + -


+

-
- +

+
-

- +

-caps) > count($profileuser->roles)): ?> +caps) > count($profileuser->roles) && apply_filters('additional_capabilities_display', true, $profileuser) ) { ?>
caps as $cap => $value) { - if(!$wp_roles->is_role($cap)) { - if($output != '') $output .= ', '; + foreach ( $profileuser->caps as $cap => $value ) { + if ( !$wp_roles->is_role($cap) ) { + if ( $output != '' ) + $output .= ', '; $output .= $value ? $cap : "Denied: {$cap}"; } } @@ -386,12 +329,12 @@ if ( $show_password_fields ) : ?>
- +

- - + +