#57843 closed enhancement (fixed)
Add action to wp_update_user
Reported by: | tanner m | Owned by: | audrasjb |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Users | Keywords: | has-patch needs-testing add-to-field-guide has-dev-note |
Focuses: | Cc: |
Description
Add an action to the end of the wp_update_user
function that includes the data set to be updated. I am working on SSO and several places use this function to set the user's password. I've included the processed data and added a new $userdata_raw
variable to pass the unprocessed data as well.
I've also added added a comment to wp_insert_user
to clarify what type of password should be passed there. Based on the current doc block, it is unclear that the password passed to wp_insert_user
should be hashed if calling the function directly to update an existing user.
Attachments (3)
Change History (19)
This ticket was mentioned in Slack in #core by tanner. View the logs.
19 months ago
#2
@
19 months ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 6.3
Hey @tanner-m!
Thanks for this one. I'm really surprised this has not been requested in the past. I did some searching, but wasn't able to find a duplicate ticket.
Moving this to the 6.3 milestone so it can get a review.
#3
@
17 months ago
Hi,
The patch works as expected.
You need to update an user and check $user_id, $userdata, $userdata_raw are available.
You can use this snippet :
<?php add_action( 'wp_update_user', function ( $user_id, $userdata, $userdata_raw ) { echo $user_id; print_r( $userdata ); print_r( $userdata_raw ); die; }, 10, 3 );
#4
@
15 months ago
- Keywords has-testing-info added
It is simple enough patch, it still has a time to be in trunk until Beta 1. @since will need to be changed if this patch is going into 6.3.
#6
@
15 months ago
Hi @tanner-m and @desrosj, I think @since should be updated and arrays descriptions before and after update can be a bit clearer.
* @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.
- These 'was updated' are a bit confusing.
This ticket was mentioned in PR #4704 on WordPress/wordpress-develop by @audrasjb.
15 months ago
#8
This ticket was mentioned in PR #4704 on WordPress/wordpress-develop by @audrasjb.
15 months ago
#9
This ticket was mentioned in Slack in #core by chaion07. View the logs.
15 months ago
#12
@
15 months ago
- Owner set to audrasjb
- Resolution set to fixed
- Status changed from new to closed
In 56071:
@audrasjb commented on PR #4704:
15 months ago
#13
merged
#15
@
14 months ago
Added to misc dev note.
draft: https://make.wordpress.org/core/?p=106236&preview=1&_ppp=2977223417
Update typo in original doc block.