WordPress.org

Make WordPress Core

Ticket #11210: pluggable.php.diff

File pluggable.php.diff, 2.4 KB (added by sirzooro, 9 years ago)
  • pluggable.php

    old new  
    11451145 * @param string $plaintext_pass Optional. The user's plaintext password
    11461146 */
    11471147function wp_new_user_notification($user_id, $plaintext_pass = '') {
     1148        wp_new_user_notification_admin( $user_id, $plaintext_pass );
     1149        wp_new_user_notification_user( $user_id, $plaintext_pass );
     1150}
     1151endif;
     1152
     1153if ( !function_exists('wp_new_user_notification_user') ) :
     1154/**
     1155 * Sends password to the new user, normally via email.
     1156 *
     1157 * @since 2.9
     1158 *
     1159 * @param int $user_id User ID
     1160 * @param string $plaintext_pass Optional. The user's plaintext password
     1161 */
     1162function wp_new_user_notification_user($user_id, $plaintext_pass = '') {
     1163        if ( empty($plaintext_pass) )
     1164                return;
     1165
    11481166        $user = new WP_User($user_id);
    11491167
    11501168        $user_login = stripslashes($user->user_login);
    11511169        $user_email = stripslashes($user->user_email);
    11521170
    1153         $message  = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n";
    1154         $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
    1155         $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
    1156 
    1157         @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);
    1158 
    1159         if ( empty($plaintext_pass) )
    1160                 return;
    1161 
    11621171        $message  = sprintf(__('Username: %s'), $user_login) . "\r\n";
    11631172        $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
    11641173        $message .= wp_login_url() . "\r\n";
    11651174
    11661175        wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
     1176}
     1177endif;
    11671178
     1179if ( !function_exists('wp_new_user_notification_admin') ) :
     1180/**
     1181 * Notify the blog admin of a new user, normally via email.
     1182 *
     1183 * @since 2.9
     1184 *
     1185 * @param int $user_id User ID
     1186 * @param string $plaintext_pass Optional. The user's plaintext password
     1187 */
     1188function wp_new_user_notification_admin($user_id, $plaintext_pass = '') {
     1189        $user = new WP_User($user_id);
     1190
     1191        $user_login = stripslashes($user->user_login);
     1192        $user_email = stripslashes($user->user_email);
     1193
     1194        $message  = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n";
     1195        $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
     1196        $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
     1197
     1198        @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);
    11681199}
    11691200endif;
    11701201