Ticket #20007: wp-reg-notify-option-patch2.diff

File wp-reg-notify-option-patch2.diff, 5.0 KB (added by Veraxus, 15 months ago)

This patch includes everything from the previous wp-reg-notify-option-patch.diff patch but also adds an option for controlling whether or not admins want to be notified of password resets.

  • wp-admin/includes/schema.php

     
    387387        'links_recently_updated_time' => 120, 
    388388        'comment_moderation' => 0, 
    389389        'moderation_notify' => 1, 
     390        'registration_notify' => 1, 
     391        'password_reset_notify' => 1, 
    390392        'permalink_structure' => '', 
    391393        'gzipcompression' => 0, 
    392394        'hack_file' => 0, 
  • wp-admin/options-discussion.php

     
    120120<tr valign="top"> 
    121121<th scope="row"><?php _e('E-mail me whenever'); ?></th> 
    122122<td><fieldset><legend class="screen-reader-text"><span><?php _e('E-mail me whenever'); ?></span></legend> 
     123<label for="registration_notify"> 
     124<input name="registration_notify" type="checkbox" id="registration_notify" value="1" <?php checked('1', get_option('registration_notify')); ?> /> 
     125<?php _e('Somebody registers'); ?> </label> 
     126<br /> 
    123127<label for="comments_notify"> 
    124128<input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> /> 
    125129<?php _e('Anyone posts a comment'); ?> </label> 
     
    127131<label for="moderation_notify"> 
    128132<input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> /> 
    129133<?php _e('A comment is held for moderation'); ?> </label> 
     134<br/> 
     135<label for="password_reset_notify"> 
     136<input name="password_reset_notify" type="checkbox" id="password_reset_notify" value="1" <?php checked('1', get_option('password_reset_notify')); ?> /> 
     137<?php _e('Anyone resets their password'); ?> </label> 
    130138</fieldset></td> 
    131139</tr> 
    132140<tr valign="top"> 
  • wp-admin/options.php

     
    6060 
    6161$whitelist_options = array( 
    6262        'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string' ), 
    63         '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' ), 
     63        'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'registration_notify','comments_notify', 'moderation_notify', 'password_reset_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' ), 
    6464        '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', 'embed_autourls', 'embed_size_w', 'embed_size_h' ), 
    6565        'privacy' => array( 'blog_public' ), 
    6666        'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ), 
  • wp-includes/pluggable.php

     
    11601160function wp_password_change_notification(&$user) { 
    11611161        // send a copy of password change notification to the admin 
    11621162        // but check to see if it's the admin whose password we're changing, and skip this 
    1163         if ( $user->user_email != get_option('admin_email') ) { 
     1163        if ( $user->user_email != get_option('admin_email') && 1 == get_option( 'password_reset_notify' ) ) { 
    11641164                $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n"; 
    11651165                // The blogname option is escaped with esc_html on the way into the database in sanitize_option 
    11661166                // we want to reverse this for the plain text arena of emails. 
     
    11931193        $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; 
    11941194        $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; 
    11951195 
    1196         @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); 
    1197  
     1196        if ( 1 == get_option( 'registration_notify' ) ) { 
     1197            @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); 
     1198        } 
     1199         
    11981200        if ( empty($plaintext_pass) ) 
    11991201                return; 
    12001202