Make WordPress Core


Ignore:
Timestamp:
09/14/2015 12:42:34 PM (9 years ago)
Author:
ocean90
Message:

Passwords: Deprecate second parameter of wp_new_user_notification().

The second parameter $plaintext_pass was removed in [33023] and restored as $notify in [33620] with a different behavior. If you have a plugin overriding wp_new_user_notification() which hasn't been updated you would get a notification with your username and the password "both".
To prevent this the second parameter is now deprecated and reintroduced as the third parameter.

Adds unit tests.

Props kraftbj, adamsilverstein, welcher, ocean90.
Fixes #33654.

(Don't ask for new pluggables kthxbye)

File:
1 edited

Legend:

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

    r34107 r34116  
    16911691 * @since 2.0.0
    16921692 * @since 4.3.0 The `$plaintext_pass` parameter was changed to `$notify`.
     1693 * @since 4.3.1 The `$plaintext_pass` parameter was deprecated. `$notify` added as a third parameter.
    16931694 *
    16941695 * @global wpdb         $wpdb      WordPress database object for queries.
    16951696 * @global PasswordHash $wp_hasher Portable PHP password hashing framework instance.
    16961697 *
    1697  * @param int    $user_id User ID.
    1698  * @param string $notify  Optional. Type of notification that should happen. Accepts 'admin' or an empty
    1699  *                        string (admin only), or 'both' (admin and user). The empty string value was kept
    1700  *                        for backward-compatibility purposes with the renamed parameter. Default empty.
    1701  */
    1702 function wp_new_user_notification( $user_id, $notify = '' ) {
     1698 * @param int    $user_id    User ID.
     1699 * @param null   $deprecated Not used (argument deprecated).
     1700 * @param string $notify     Optional. Type of notification that should happen. Accepts 'admin' or an empty
     1701 *                           string (admin only), or 'both' (admin and user). The empty string value was kept
     1702 *                           for backward-compatibility purposes with the renamed parameter. Default empty.
     1703 */
     1704function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
     1705    if ( $deprecated !== null ) {
     1706        _deprecated_argument( __FUNCTION__, '4.3.1' );
     1707    }
     1708
    17031709    global $wpdb, $wp_hasher;
    17041710    $user = get_userdata( $user_id );
Note: See TracChangeset for help on using the changeset viewer.