Make WordPress Core

Opened 2 days ago

Last modified 22 hours ago

#61541 new enhancement

wp_set_password hook lacks previous context

Reported by: dd32's profile dd32 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.2
Component: Users Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

In #57436 a hook was added to wp_set_password, but unlike the other user-related hooks, this hook doesn't pass the previous state of the user as context to the hook.

Adding additional context, either as the fields that have been modified, or as a full WP_User would be appreciated for logging and authentication plugins.

<?php
$old_user_data = array( 'user_pass' => ...., 'user_activation_key' => ... );
or
$old_user_data = get_user_by( ... )

// perform user update; $wpdb->update()

do_action( 'wp_set_password', $password, $user_id, $old_user_data );

Change History (1)

This ticket was mentioned in PR #6948 on WordPress/wordpress-develop by @dd32.


22 hours ago
#1

  • Keywords has-patch has-unit-tests added

Similar to other user hooks that pass the previous user state, this adds the previous user state to the wp_set_password hook.

This passes the full user details, rather than only the changed details, for consistency with other hooks.

Trac ticket: https://core.trac.wordpress.org/ticket/61541

Note: See TracTickets for help on using tickets.