WordPress.org

Make WordPress Core

Ticket #9137: annoying_emails.diff

File annoying_emails.diff, 4.8 KB (added by sirzooro, 6 years ago)
  • wp-admin/includes/schema.php

    diff -Naur ori/wp-admin/includes/schema.php new/wp-admin/includes/schema.php
    ori new  
    186186        add_option('blogdescription', __('Just another WordPress weblog')); 
    187187        add_option('users_can_register', 0); 
    188188        add_option('admin_email', 'you@example.com'); 
     189        add_option('send_annoying_emails_to_admin', 1); 
    189190        add_option('start_of_week', 1); 
    190191        add_option('use_balanceTags', 0); 
    191192        add_option('use_smilies', 1); 
  • wp-admin/options-general.php

    diff -Naur ori/wp-admin/options-general.php new/wp-admin/options-general.php
    ori new  
    8080<span class="setting-description"><?php _e('This address is used for admin purposes, like new user notification.') ?></span></td> 
    8181</tr> 
    8282<tr valign="top"> 
     83<th scope="row"><label for="send_annoying_emails_to_admin"><?php _e('Send annoying emails') ?> </label></th> 
     84<td><input name="send_annoying_emails_to_admin" type="checkbox" id="send_annoying_emails_to_admin" value="1" <?php checked('1', get_option('send_annoying_emails_to_admin')); ?>" /> 
     85<span class="setting-description"><?php _e('Send annoying emails to admin, like new user notification.') ?></span></td> 
     86</tr> 
     87<tr valign="top"> 
    8388<th scope="row"><?php _e('Membership') ?></th> 
    8489<td> <fieldset><legend class="hidden"><?php _e('Membership') ?></legend><label for="users_can_register"> 
    8590<input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> /> 
  • wp-admin/options.php

    diff -Naur ori/wp-admin/options.php new/wp-admin/options.php
    ori new  
    2222wp_reset_vars(array('action')); 
    2323 
    2424$whitelist_options = array( 
    25         'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role' ), 
     25        'general' => array( 'blogname', 'blogdescription', 'admin_email', 'send_annoying_emails_to_admin', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role' ), 
    2626        'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ), 
    2727        'misc' => array( 'hack_file', 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path' ), 
    2828        'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ), 
  • wp-includes/pluggable.php

    diff -Naur ori/wp-includes/pluggable.php new/wp-includes/pluggable.php
    ori new  
    10811081function wp_password_change_notification(&$user) { 
    10821082        // send a copy of password change notification to the admin 
    10831083        // but check to see if it's the admin whose password we're changing, and skip this 
    1084         if ( $user->user_email != get_option('admin_email') ) { 
     1084        if ( ( $user->user_email != get_option('admin_email') ) && get_option('send_annoying_emails_to_admin') ) { 
    10851085                $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n"; 
    10861086                wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), get_option('blogname')), $message); 
    10871087        } 
     
    11031103        $user_login = stripslashes($user->user_login); 
    11041104        $user_email = stripslashes($user->user_email); 
    11051105 
    1106         $message  = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n"; 
    1107         $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; 
    1108         $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; 
     1106        if ( get_option('send_annoying_emails_to_admin') ) 
     1107        { 
     1108                $message  = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n"; 
     1109                $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; 
     1110                $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; 
    11091111 
    1110         @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message); 
     1112                @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message); 
     1113        } 
    11111114 
    11121115        if ( empty($plaintext_pass) ) 
    11131116                return;