From f24da9abad00f1de698c7216b122717cc763da94 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sun, 21 Mar 2010 01:36:54 +0000 Subject: [PATCH] Fix WP_User::remove_role(). See #10285 git-svn-id: https://develop.svn.wordpress.org/trunk@13784 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/capabilities.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index fb6315a12e..366de783cd 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -581,11 +581,12 @@ class WP_User { * @param string $role Role name. */ function remove_role( $role ) { - if ( empty( $this->roles[$role] ) || ( count( $this->roles ) <= 1 ) ) + if ( !in_array($role, $this->roles) ) return; unset( $this->caps[$role] ); update_user_meta( $this->ID, $this->cap_key, $this->caps ); $this->get_role_caps(); + $this->update_user_level_from_caps(); } /**