mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-15 23:25:50 +01:00
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
This commit is contained in:
parent
66c363de8f
commit
362b41c33a
@ -803,6 +803,7 @@ class WP_User {
|
|||||||
foreach ( (array) $this->roles as $oldrole )
|
foreach ( (array) $this->roles as $oldrole )
|
||||||
unset( $this->caps[$oldrole] );
|
unset( $this->caps[$oldrole] );
|
||||||
|
|
||||||
|
$old_roles = $this->roles;
|
||||||
if ( !empty( $role ) ) {
|
if ( !empty( $role ) ) {
|
||||||
$this->caps[$role] = true;
|
$this->caps[$role] = true;
|
||||||
$this->roles = array( $role => true );
|
$this->roles = array( $role => true );
|
||||||
@ -812,7 +813,7 @@ class WP_User {
|
|||||||
update_user_meta( $this->ID, $this->cap_key, $this->caps );
|
update_user_meta( $this->ID, $this->cap_key, $this->caps );
|
||||||
$this->get_role_caps();
|
$this->get_role_caps();
|
||||||
$this->update_user_level_from_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…
Reference in New Issue
Block a user