WordPress.org

Make WordPress Core

Ticket #9137: admin_notifications.diff

File admin_notifications.diff, 6.4 KB (added by sirzooro, 9 years ago)
  • wp-admin/includes/schema.php

    diff -Naur ori/wp-admin/includes/schema.php new/wp-admin/includes/schema.php
    ori new  
    302302        add_option('update_core', array());
    303303        add_option('dismissed_update_core', array());
    304304
     305        // 2.8
     306        add_option('new_login_notifications', 1);
     307        add_option('password_reset_notifications', 1);
     308
    305309        // Delete unused options
    306310        $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins');
    307311        foreach ($unusedoptions as $option) :
  • 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"><?php _e('New login notifications') ?></th>
     84<td> <fieldset><legend class="hidden"><?php _e('Membership') ?></legend><label for="new_login_notifications">
     85<input name="new_login_notifications" type="checkbox" id="new_login_notifications" value="1" <?php checked('1', get_option('new_login_notifications')); ?> />
     86<?php _e('Send notification of new login creation to admin') ?></label>
     87</fieldset></td>
     88</tr>
     89<tr valign="top">
     90<th scope="row"><?php _e('Password reset notifications') ?></th>
     91<td> <fieldset><legend class="hidden"><?php _e('Membership') ?></legend><label for="password_reset_notifications">
     92<input name="password_reset_notifications" type="checkbox" id="password_reset_notifications" value="1" <?php checked('1', get_option('password_reset_notifications')); ?> />
     93<?php _e('Send notification of password resets to admin') ?></label>
     94</fieldset></td>
     95</tr>
     96<tr valign="top">
    8397<th scope="row"><?php _e('Membership') ?></th>
    8498<td> <fieldset><legend class="hidden"><?php _e('Membership') ?></legend><label for="users_can_register">
    8599<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', 'new_login_notifications', 'password_reset_notifications', '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('password_reset_notifications') ) {
    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('new_login_notifications') )
     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;