Add add_user_role and remove_user_role actions for WP_User::add_role() and remove_role().

props shooper.
fixes #32060.


git-svn-id: https://develop.svn.wordpress.org/trunk@32771 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2015-06-14 19:25:17 +00:00
parent 7988f78e44
commit 3c554c0391
1 changed files with 20 additions and 0 deletions

View File

@ -840,6 +840,16 @@ class WP_User {
update_user_meta( $this->ID, $this->cap_key, $this->caps );
$this->get_role_caps();
$this->update_user_level_from_caps();
/**
* Fires immediately after the user has been given a new role.
*
* @since 4.3.0
*
* @param int $user_id The user ID.
* @param string $role The new role.
*/
do_action( 'add_user_role', $this->ID, $role );
}
/**
@ -857,6 +867,16 @@ class WP_User {
update_user_meta( $this->ID, $this->cap_key, $this->caps );
$this->get_role_caps();
$this->update_user_level_from_caps();
/**
* Fires immediately after a role as been removed from a user.
*
* @since 4.3.0
*
* @param int $user_id The user ID.
* @param string $role The removed role.
*/
do_action( 'remove_user_role', $this->ID, $role );
}
/**