From 1053ca70140d039f6f6790a550ee48f2872c5009 Mon Sep 17 00:00:00 2001
From: Ryan Boren
Date: Sat, 10 Jun 2006 20:26:26 +0000
Subject: [PATCH] Better handling of users with no role. Props Mark Jaquith.
#2809
git-svn-id: https://develop.svn.wordpress.org/trunk@3859 602fd350-edb4-49c9-b593-d223f7449a82
---
wp-admin/user-edit.php | 17 ++++++++++++++---
wp-admin/users.php | 4 ++++
wp-includes/capabilities.php | 10 +++++++---
wp-includes/registration-functions.php | 2 +-
4 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php
index 851451ac06..f7ab8f7a21 100644
--- a/wp-admin/user-edit.php
+++ b/wp-admin/user-edit.php
@@ -103,11 +103,22 @@ if ( !current_user_can('edit_user', $user_id) )
';
+$role_list = '';
+$user_has_role = false;
foreach($wp_roles->role_names as $role => $name) {
- $selected = ($profileuser->has_cap($role)) ? ' selected="selected"' : '';
- echo "";
+ if ( $profileuser->has_cap($role) ) {
+ $selected = ' selected="selected"';
+ $user_has_role = true;
+ } else {
+ $selected = '';
+ }
+ $role_list .= "";
}
-echo '';
+if ( $user_has_role )
+ $role_list .= '';
+else
+ $role_list .= '';
+echo $role_list . '';
?>