WordPress.org

Make WordPress Core

Ticket #38068: 38068.patch

File 38068.patch, 9.2 KB (added by pbearne, 3 years ago)

patch using array format

  • src/wp-includes/pluggable.php

     
    17461746                $message = sprintf( __( 'Password changed for user: %s' ), $user->user_login ) . "\r\n";
    17471747                // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    17481748                // we want to reverse this for the plain text arena of emails.
    1749                 $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     1749                $blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    17501750
    1751                 /* translators: %s: site title */
    1752                 $subject = sprintf( __( '[%s] Password Changed' ), $blogname );
    1753 
     1751                $wp_password_change_notification_email = array(
     1752                        'to'      => get_option( 'admin_email' ),
     1753                        /* translators: Password change notification email subject. 1: Site name */
     1754                        'subject' => __( '[%s] Password Changed' ),
     1755                        'message' => $message,
     1756                        'headers' => '',
     1757                );
    17541758                /**
    1755                  * Filters the subject of the password change notification email sent to the site admin.
     1759                 * Filters the contents of the password change notification email sent to the site admin.
    17561760                 *
    17571761                 * @since 4.9.0
    17581762                 *
    1759                  * @param string  $subject  Email subject.
     1763                 * @param array  $wp_password_change_notification_email{
     1764                 *   Used to build wp_mail().
     1765                 *            @type string $to      The intended recipients - admin_email.
     1766                 *            @type string $subject The subject of the email.
     1767                 *            @type string $message The content of the email.
     1768                 * }
    17601769                 * @param WP_User $user     User object for user whose password was changed.
    1761                  * @param string  $blogname The site title.
     1770                 * @param string  $blog_name The site title.
    17621771                 */
    1763                 $subject = apply_filters( 'wp_password_change_notification_subject', $subject, $user, $blogname );
     1772                $wp_password_change_notification_email = apply_filters( 'wp_password_change_notification_email', $wp_password_change_notification_email, $user, $blog_name );
    17641773
    1765                 /**
    1766                  * Filters the message body of the password change notification email sent to the site admin.
    1767                  *
    1768                  * @since 4.9.0
    1769                  *
    1770                  * @param string  $message Email message.
    1771                  * @param WP_User $user    User object for user whose password was changed.
    1772                  */
    1773                 $message = apply_filters( 'wp_password_change_notification_message', $message, $user );
    1774 
    1775                 /**
    1776                  * Filters the email headers of the password change notification admin email sent to the site admin.
    1777                  *
    1778                  * @since 4.9.0
    1779                  *
    1780                  * @param string  $headers Email headers.
    1781                  * @param WP_User $user    User object for user whose password was changed.
    1782                  */
    1783                 $headers = apply_filters( 'wp_password_change_notification_headers', '', $user );
    1784 
    1785                 wp_mail( get_option( 'admin_email' ), wp_specialchars_decode( $subject ), $message, $headers );
     1774                wp_mail( $wp_password_change_notification_email['to'],
     1775                        wp_specialchars_decode( sprintf( $wp_password_change_notification_email['subject'] ), $blog_name ),
     1776                        $wp_password_change_notification_email['message'],
     1777                        $wp_password_change_notification_email['headers']
     1778                );
    17861779        }
    17871780}
    17881781endif;
     
    18161809
    18171810        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    18181811        // we want to reverse this for the plain text arena of emails.
    1819         $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     1812        $blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    18201813
    18211814        if ( 'user' !== $notify ) {
    18221815                $switched_locale = switch_to_locale( get_locale() );
    18231816
    18241817                /* translators: %s: site title */
    1825                 $subject  = sprintf( __( '[%s] New User Registration' ), $blogname );
    1826                 /* translators: %s: site title */
    1827                 $message  = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
     1818                $message  = sprintf( __( 'New user registration on your site %s:' ), $blog_name ) . "\r\n\r\n";
    18281819                /* translators: %s: user login */
    18291820                $message .= sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";
    18301821                /* translators: %s: user email address */
    18311822                $message .= sprintf( __( 'Email: %s' ), $user->user_email ) . "\r\n";
    18321823
     1824                $wp_new_user_notification_email_admin = array(
     1825                        'to'      => get_option( 'admin_email' ),
     1826                        /* translators: Password change notification email subject. 1: Site name */
     1827                        'subject' => __( '[%s] New User Registration' ),
     1828                        'message' => $message,
     1829                        'headers' => '',
     1830                );
    18331831                /**
    1834                  * Filters the subject of the new user notification email sent to the site admin.
     1832                 * Filters the contents of the new user notification email sent to the site admin.
    18351833                 *
    18361834                 * @since 4.9.0
    18371835                 *
    1838                  * @param string  $subject  Email subject.
    1839                  * @param WP_User $user     User object for newly registered user.
    1840                  * @param string  $blogname The site title.
     1836                 * @param array $wp_new_user_notification_email{
     1837                 *   Used to build wp_mail().
     1838                 *            @type string $to      The intended recipients - admin_email.
     1839                 *            @type string $subject The subject of the email.
     1840                 *            @type string $message The content of the email.
     1841                 * }
     1842                 * @param WP_User $user     User object for user whose password was changed.
     1843                 * @param string  $blog_name The site title.
    18411844                 */
    1842                 $subject = apply_filters( 'wp_new_user_notification_admin_subject', $subject, $user, $blogname );
     1845                $wp_new_user_notification_email = apply_filters( 'wp_new_user_notification_email_admin', $wp_new_user_notification_email_admin, $user, $blog_name );
    18431846
    1844                 /**
    1845                  * Filters the message body of the new user notification email sent to the site admin.
    1846                  *
    1847                  * @since 4.9.0
    1848                  *
    1849                  * @param string  $message Email message.
    1850                  * @param WP_User $user    User object for newly registered user.
    1851                  */
    1852                 $message = apply_filters( 'wp_new_user_notification_admin_message', $message, $user );
     1847                @wp_mail( $wp_new_user_notification_email_admin['to'],
     1848                        wp_specialchars_decode( sprintf( $wp_new_user_notification_email_admin['subject'] ), $blog_name ),
     1849                        $wp_new_user_notification_email_admin['message'],
     1850                        $wp_new_user_notification_email_admin['headers']
     1851                );
    18531852
    1854                 /**
    1855                  * Filters the email headers of the new user notification email sent to the site admin.
    1856                  *
    1857                  * @since 4.9.0
    1858                  *
    1859                  * @param string  $headers Email headers.
    1860                  * @param WP_User $user    User object for newly registered user.
    1861                  */
    1862                 $headers = apply_filters( 'wp_new_user_notification_admin_headers', '', $user );
    1863 
    1864                 @wp_mail( get_option( 'admin_email' ), wp_specialchars_decode( $subject ), $message, $headers );
    1865 
    18661853                if ( $switched_locale ) {
    18671854                        restore_previous_locale();
    18681855                }
     
    18891876
    18901877        $switched_locale = switch_to_locale( get_user_locale( $user ) );
    18911878
    1892         /* translators: %s: site title */
    1893         $subject = sprintf( __( '[%s] Your username and password info' ), $blogname );
    18941879        /* translators: %s: user login */
    18951880        $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
    18961881        $message .= __('To set your password, visit the following address:') . "\r\n\r\n";
     
    18981883
    18991884        $message .= wp_login_url() . "\r\n";
    19001885
     1886        $wp_new_user_notification_email = array(
     1887                'to'      => $user->user_email,
     1888                /* translators: Password change notification email subject. 1: Site name */
     1889                'subject' => __( '[%s] Your username and password info' ),
     1890                'message' => $message,
     1891                'headers' => '',
     1892        );
    19011893        /**
    1902          * Filters the subject of the new user email sent to the new user.
     1894         * Filters the contents of the new user notification email sent to the new user.
    19031895         *
    19041896         * @since 4.9.0
    19051897         *
    1906          * @param string  $subject  Email subject.
    1907          * @param WP_User $user     User object for newly registered user.
    1908          * @param string  $blogname The site title.
     1898         * @param array $wp_new_user_notification_email{
     1899         *   Used to build wp_mail().
     1900         *            @type string $to      The intended recipients - user_email.
     1901         *            @type string $subject The subject of the email.
     1902         *            @type string $message The content of the email.
     1903         * }
     1904         * @param WP_User $user     User object for user whose password was changed.
     1905         * @param string  $blog_name The site title.
    19091906         */
    1910         $subject = apply_filters( 'wp_new_user_notification_subject', $subject, $user, $blogname );
     1907        $wp_new_user_notification_email = apply_filters( 'wp_new_user_notification_email', $wp_new_user_notification_email, $user, $blog_name );
    19111908
    1912         /**
    1913          * Filters the message body of the new user email sent to the new user.
    1914          *
    1915          * @since 4.9.0
    1916          *
    1917          * @param string  $message Email message.
    1918          * @param WP_User $user    User object for newly registered user.
    1919          * @param string  $key     User activation key.
    1920          */
    1921         $message = apply_filters( 'wp_new_user_notification_message', $message, $user, $key );
     1909        wp_mail( $wp_new_user_notification_email['to'],
     1910                wp_specialchars_decode( sprintf( $wp_new_user_notification_email['subject'] ), $blog_name ),
     1911                $wp_new_user_notification_email['message'],
     1912                $wp_new_user_notification_email['headers']
     1913        );
    19221914
    1923         /**
    1924          * Filters the email headers of the new user email sent to the new user.
    1925          *
    1926          * @since 4.9.0
    1927          *
    1928          * @param string  $headers Email headers.
    1929          * @param WP_User $user    User object for newly registered user.
    1930          */
    1931         $headers = apply_filters( 'wp_new_user_notification_headers', '', $user );
    1932 
    1933         wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $headers );
    1934 
    19351915        if ( $switched_locale ) {
    19361916                restore_previous_locale();
    19371917        }