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

props shooper.
fixes #32060.

Built from https://develop.svn.wordpress.org/trunk@32771


git-svn-id: http://core.svn.wordpress.org/trunk@32742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2015-06-14 19:26:25 +00:00
parent 38d59c0828
commit 748b3763cb
2 changed files with 21 additions and 1 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 );
}
/**

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-alpha-32770';
$wp_version = '4.3-alpha-32771';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.