From e1a7cc966fde712dc296e3ca573818a9bf7f6e5c Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 22 Oct 2010 19:38:20 +0000 Subject: [PATCH] Do not set role if it is the same. Props nickmomrik. fixes #14708 git-svn-id: http://svn.automattic.com/wordpress/trunk@15919 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/capabilities.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index e8c9face3..93a9f687e 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -605,6 +605,10 @@ class WP_User { function set_role( $role ) { foreach ( (array) $this->roles as $oldrole ) unset( $this->caps[$oldrole] ); + + if ( 1 == count( $this->roles ) && $role == $this->roles[0] ) + return; + if ( !empty( $role ) ) { $this->caps[$role] = true; $this->roles = array( $role => true );