Ticket #39697: 39697-concept.patch
File 39697-concept.patch, 2.1 KB (added by , 6 years ago) |
---|
-
wp-includes/user.php
1870 1870 * cleared. 1871 1871 * 1872 1872 * @since 2.0.0 1873 * @since 5.x.x Added $args parameter. 1873 1874 * 1874 1875 * @see wp_insert_user() For what fields can be set in $userdata. 1875 1876 * 1876 1877 * @param array|object|WP_User $userdata An array of user data or a user object of type stdClass or WP_User. 1878 * @param array $args { 1879 * An array of arguments. 1880 * 1881 * @type bool $send_password_change_email Send email if password is changed? 1882 * @type bool $send_email_change_email Send email if email is changed? 1883 * } 1877 1884 * @return int|WP_Error The updated user's ID or a WP_Error object if the user could not be updated. 1878 1885 */ 1879 1886 function wp_update_user( $userdata ) { … … 1883 1890 $userdata = $userdata->to_array(); 1884 1891 } 1885 1892 1893 $defaults = array( 1894 'send_password_change_email' => true, 1895 'send_email_change_email' => true, 1896 ); 1897 1898 $args = wp_parse_args( $args, $defaults ); 1899 1886 1900 $ID = isset( $userdata['ID'] ) ? (int) $userdata['ID'] : 0; 1887 1901 if ( ! $ID ) { 1888 1902 return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) ); … … 1920 1934 * @param array $user The original user array. 1921 1935 * @param array $userdata The updated user array. 1922 1936 */ 1923 $send_password_change_email = apply_filters( 'send_password_change_email', true, $user, $userdata );1937 $send_password_change_email = apply_filters( 'send_password_change_email', (bool) $args['send_password_change_email'], $user, $userdata ); 1924 1938 } 1925 1939 1926 1940 if ( isset( $userdata['user_email'] ) && $user['user_email'] !== $userdata['user_email'] ) { … … 1935 1949 * @param array $user The original user array. 1936 1950 * @param array $userdata The updated user array. 1937 1951 */ 1938 $send_email_change_email = apply_filters( 'send_email_change_email', true, $user, $userdata );1952 $send_email_change_email = apply_filters( 'send_email_change_email', (bool) $args['send_email_change_email'], $user, $userdata ); 1939 1953 } 1940 1954 1941 1955 wp_cache_delete( $user['user_email'], 'useremail' );