Make WordPress Core


Ignore:
Timestamp:
08/13/2025 08:12:46 PM (3 months ago)
Author:
davidbaumwald
Message:

Users: Fire wp_set_password action when creating or updating a user's password.

Various filters and actions fire during user creation and editing, making available all manner of user data to be acted upon by custom code. However, a user's password was not included in the data that was made available.

This change now fires an existing action, wp_set_password, during initial user creation and when an existing user's password is updated.

Props ChloeD, scribu, dd32, pento, chriscct7, johnbillion, logicrays, nimeshatxecurify.
Fixes #22114.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r60489 r60634  
    25022502    $user = new WP_User( $user_id );
    25032503
     2504    if ( ! $update ) {
     2505        /** This action is documented in wp-includes/pluggable.php */
     2506        do_action( 'wp_set_password', $userdata['user_pass'], $user_id, $userdata );
     2507    }
     2508
    25042509    /**
    25052510     * Filters a user's meta values and keys immediately after the user is created or updated
     
    26842689        $plaintext_pass        = $userdata['user_pass'];
    26852690        $userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] );
     2691
     2692        /** This action is documented in wp-includes/pluggable.php */
     2693        do_action( 'wp_set_password', $plaintext_pass, $user_id, $user_obj );
    26862694
    26872695        /**
Note: See TracChangeset for help on using the changeset viewer.