Users: Introduce the `wp_update_user` action.
This changeset introduces the `wp_update_user` action hook, which fires after the user has been updated and emails have been sent. Props tanner-m, desrosj, lphoumpakka, oglekler, audrasjb, azzaoz. Fixes #57843. Built from https://develop.svn.wordpress.org/trunk@56071 git-svn-id: http://core.svn.wordpress.org/trunk@55583 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6f5741c348
commit
955720d678
|
@ -2030,7 +2030,8 @@ function validate_username( $username ) {
|
||||||
* An array, object, or WP_User object of user data arguments.
|
* An array, object, or WP_User object of user data arguments.
|
||||||
*
|
*
|
||||||
* @type int $ID User ID. If supplied, the user will be updated.
|
* @type int $ID User ID. If supplied, the user will be updated.
|
||||||
* @type string $user_pass The plain-text user password.
|
* @type string $user_pass The plain-text user password for new users.
|
||||||
|
* Hashed password for existing users.
|
||||||
* @type string $user_login The user's login username.
|
* @type string $user_login The user's login username.
|
||||||
* @type string $user_nicename The URL-friendly user name.
|
* @type string $user_nicename The URL-friendly user name.
|
||||||
* @type string $user_url The user URL.
|
* @type string $user_url The user URL.
|
||||||
|
@ -2520,6 +2521,8 @@ function wp_update_user( $userdata ) {
|
||||||
$userdata = $userdata->to_array();
|
$userdata = $userdata->to_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$userdata_raw = $userdata;
|
||||||
|
|
||||||
$user_id = isset( $userdata['ID'] ) ? (int) $userdata['ID'] : 0;
|
$user_id = isset( $userdata['ID'] ) ? (int) $userdata['ID'] : 0;
|
||||||
if ( ! $user_id ) {
|
if ( ! $user_id ) {
|
||||||
return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
|
return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
|
||||||
|
@ -2734,6 +2737,17 @@ All at ###SITENAME###
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires after the user has been updated and emails have been sent.
|
||||||
|
*
|
||||||
|
* @since 6.3.0
|
||||||
|
*
|
||||||
|
* @param int $user_id The ID of the user that was just updated.
|
||||||
|
* @param array $userdata The array of user data that was updated.
|
||||||
|
* @param array $userdata_raw The unedited array of user data that was updated.
|
||||||
|
*/
|
||||||
|
do_action( 'wp_update_user', $user_id, $userdata, $userdata_raw );
|
||||||
|
|
||||||
return $user_id;
|
return $user_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.3-alpha-56070';
|
$wp_version = '6.3-alpha-56071';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue