From 362b41c33a3eb4121975b0de2f2e61c54309b012 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 31 Jan 2013 01:15:25 +0000 Subject: [PATCH] Pass old roles to set_user_role action. props awellis13. fixes #19134. git-svn-id: http://core.svn.wordpress.org/trunk@23358 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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 3503316ccf..6a7b021156 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -803,6 +803,7 @@ class WP_User { foreach ( (array) $this->roles as $oldrole ) unset( $this->caps[$oldrole] ); + $old_roles = $this->roles; if ( !empty( $role ) ) { $this->caps[$role] = true; $this->roles = array( $role => true ); @@ -812,7 +813,7 @@ class WP_User { update_user_meta( $this->ID, $this->cap_key, $this->caps ); $this->get_role_caps(); $this->update_user_level_from_caps(); - do_action( 'set_user_role', $this->ID, $role ); + do_action( 'set_user_role', $this->ID, $role, $old_roles ); } /**