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:
parent
633d1902b5
commit
78b69ff012
@ -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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user