Pass old roles to set_user_role action. props awellis13. fixes #19134.

git-svn-id: https://develop.svn.wordpress.org/trunk@23358 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2013-01-31 01:15:25 +00:00
parent 633d1902b5
commit 78b69ff012
1 changed files with 2 additions and 1 deletions

View File

@ -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 );
}
/**