[wp-trac] [WordPress Trac] #45746: get_password_reset_key should use wp_update_user
WordPress Trac
noreply at wordpress.org
Sun Jan 6 01:10:24 UTC 2019
#45746: get_password_reset_key should use wp_update_user
--------------------------------------+------------------------------
Reporter: spacedmonkey | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 4.4
Severity: normal | Resolution:
Keywords: good-first-bug has-patch | Focuses:
--------------------------------------+------------------------------
Comment (by spacedmonkey):
Thanks @jayswadas for the patch.
Looking at the patch, there a couple of issues, I had with it. I would
change it the following
{{{#!php
$key_saved = wp_update_user( array( 'ID' => $user->ID,
'user_activation_key' => $hashed, 'user_login' => $user->user_login ) );
if ( is_wp_error( $key_saved ) ) {
return $key_saved;
}
}}}
Couple of differences.
1. Removed `clean_user_cache` call, as this is already classed in
`wp_update_user`
2. Check the value `$key_saved` and return. As `wp_update_user` doesn't
allows successfully.
If you can update the patch @jayswadas and run the phpunit tests, we could
nearly be there.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45746#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list