Ticket #6286: 6286.3.diff
File 6286.3.diff, 9.9 KB (added by , 12 years ago) |
---|
-
wp-includes/comment.php
1407 1407 1408 1408 $post = get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment 1409 1409 1410 if ( get_option( 'comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) )1410 if ( get_option( 'comments_notify', $post->post_author ) && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) ) 1411 1411 wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' ); 1412 1412 } 1413 1413 … … 1440 1440 case 'approve': 1441 1441 case '1': 1442 1442 $status = '1'; 1443 if ( get_option('comments_notify') ) {1444 $comment = get_comment($comment_id);1445 wp_notify_postauthor($comment_id, $comment->comment_type);1446 }1443 $comment = get_comment( $comment_id ); 1444 $post = get_post( $comment->comment_post_ID ); 1445 if ( get_user_option( 'comments_notify', $post->post_author ) ) 1446 wp_notify_postauthor( $comment_id, $comment->comment_type ); 1447 1447 break; 1448 1448 case 'spam': 1449 1449 $status = 'spam'; … … 1626 1626 return true; 1627 1627 } 1628 1628 1629 /** 1630 * Gets the User IDs of the users who should be emailed if a 1631 * particular comment is held for moderation. 1632 * 1633 * @param int $comment_id The ID of the comment we want moderation recipients for 1634 * @return array An array of WP_User objects 1635 **/ 1636 function wp_get_moderation_recipients( $comment_id ) { 1637 global $wpdb; 1638 1639 $comment = get_comment( $comment_id ); 1640 $post = get_post( $comment->comment_post_ID ); 1641 1642 // Find the IDs of the users who have requested moderation notifications in 1643 // one way or another. 1644 $sql = " SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s OR ( user_id = %d AND meta_key = %s ) "; 1645 $user_ids = $wpdb->get_col( $wpdb->prepare( $sql, 1646 $wpdb->prefix . 'moderation_notify', 1647 $post->post_author, 1648 $wpdb->prefix . 'moderation_notify_all' 1649 ) ); 1650 1651 $users = array_map( array( 'WP_User', '__construct' ), array_unique( $user_ids ) ); 1652 1653 return $users; 1654 } 1655 1629 1656 // 1630 1657 // Ping and trackback functions. 1631 1658 // -
wp-includes/pluggable.php
1094 1094 function wp_notify_moderator($comment_id) { 1095 1095 global $wpdb; 1096 1096 1097 if ( 0 == get_option( 'moderation_notify') )1097 if ( ! $recipients = wp_get_moderation_recipients( $comment_id ) ) 1098 1098 return true; 1099 1099 1100 $email_to = wp_list_pluck( $recipients, 'user_email' ); 1101 1100 1102 $comment = get_comment($comment_id); 1101 1103 $post = get_post($comment->comment_post_ID); 1102 $user = get_userdata( $post->post_author );1103 // Send to the administration and to the post author if the author can modify the comment.1104 $email_to = array( get_option('admin_email') );1105 if ( user_can($user->ID, 'edit_comment', $comment_id) && !empty($user->user_email) && ( get_option('admin_email') != $user->user_email) )1106 $email_to[] = $user->user_email;1107 1104 1108 1105 $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); 1109 1106 $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'"); … … 1112 1109 // we want to reverse this for the plain text arena of emails. 1113 1110 $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); 1114 1111 1115 switch ($comment->comment_type) 1116 { 1112 switch ($comment->comment_type) { 1117 1113 case 'trackback': 1118 1114 $notify_message = sprintf( __('A new trackback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n"; 1119 1115 $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n"; -
wp-admin/includes/user.php
161 161 $user_id = wp_insert_user( $user ); 162 162 wp_new_user_notification( $user_id, isset($_POST['send_password']) ? $pass1 : '' ); 163 163 } 164 165 if ( user_can( $user_id, 'moderate_comments' ) ) { 166 foreach ( array( 'comments_notify', 'moderation_notify', 'moderation_notify_all' ) as $option ) 167 if ( isset( $_POST[$option] ) ) 168 update_user_option( $user_id, $option, $_POST[$option] ); 169 } 170 164 171 return $user_id; 165 172 } 166 173 -
wp-admin/options-discussion.php
120 120 </fieldset></td> 121 121 </tr> 122 122 <tr valign="top"> 123 <th scope="row"><?php _e('E-mail me whenever'); ?></th>124 <td><fieldset><legend class="screen-reader-text"><span><?php _e('E-mail me whenever'); ?></span></legend>125 <label for="comments_notify">126 <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />127 <?php _e('Anyone posts a comment'); ?> </label>128 <br />129 <label for="moderation_notify">130 <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> />131 <?php _e('A comment is held for moderation'); ?> </label>132 </fieldset></td>133 </tr>134 <tr valign="top">135 123 <th scope="row"><?php _e('Before a comment appears'); ?></th> 136 124 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Before a comment appears'); ?></span></legend> 137 125 <label for="comment_moderation"> -
wp-admin/user-edit.php
37 37 $parent_file = 'profile.php'; 38 38 39 39 $profile_help = '<p>' . __('Your profile contains information about you (your “account”) as well as some personal options related to using WordPress.') . '</p>' . 40 '<p>' . __('You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, and turn off the WYSIWYG (Visual) editor, among other things. You can hide the Toolbar (formerly called the Admin Bar) from the front end of your site, however it cannot be disabled on the admin screens.') . '</p>' . 41 '<p>' . __('Your username cannot be changed, but you can use other fields to enter your real name or a nickname, and change which name to display on your posts.') . '</p>' . 40 '<p>' . __('Your username cannot be changed, but you can use other fields to enter your real name or a nickname, and change which name to display on your posts. You can also change your password on this screen.') . '</p>' . 42 41 '<p>' . __('Required fields are indicated; the rest are optional. Profile information will only be displayed if your theme is set up to do so.') . '</p>' . 43 42 '<p>' . __('Remember to click the Update Profile button when you are finished.') . '</p>'; 44 43 … … 48 47 'content' => $profile_help, 49 48 ) ); 50 49 50 $personal_options = '<p>' . __( 'Personal options allow you to customize your WordPress experience. Among other things, you can:' ) . '</p>' . 51 '<ul><li>' . __( 'Turn off the WYSIWYG (Visual) editor' ) . '</li>' . 52 '<li>' . __( 'Change the color scheme of your WordPress administration screens' ) . '</li>' . 53 '<li>' . __( 'Turn on keyboard shortcuts' ) . '</li>' . 54 '<li>' . __( 'Manage email notification settings' ) . '</li></ul>' . 55 '<p>' . __( 'You can also hide the Toolbar (formerly called the Admin Bar) from the front end of your site, however it cannot be disabled on the admin screens.' ) . '</p>'; 56 57 get_current_screen()->add_help_tab( array( 58 'id' => 'personal-options', 59 'title' => __( 'Personal Options' ), 60 'content' => $personal_options 61 ) ); 62 51 63 get_current_screen()->set_help_sidebar( 52 64 '<p><strong>' . __('For more information:') . '</strong></p>' . 53 65 '<p>' . __('<a href="http://codex.wordpress.org/Users_Your_Profile_Screen" target="_blank">Documentation on User Profiles</a>') . '</p>' . … … 221 233 <td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( !empty($profileuser->comment_shortcuts) ) checked('true', $profileuser->comment_shortcuts); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="http://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?></td> 222 234 </tr> 223 235 <?php endif; ?> 236 237 <?php if ( user_can( $profileuser->ID, 'moderate_comments' ) ) : ?> 238 <tr valign="top"> 239 <th scope="row"><?php _e( 'E-mail me whenever:' ) ?></th> 240 <td><fieldset> 241 <legend class="screen-reader-text"> 242 <span><?php _e( 'E-mail me whenever' ) ?></span> 243 </legend><!-- .screen-reader-text --> 244 245 <input type="hidden" name="email_notifications" value="1" /> 246 <label for="comments_notify"> 247 <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked( '1', get_user_option( 'comments_notify', $profileuser->ID ) ); ?> /> 248 <?php _e( 'A comment is posted on one of my posts' ) ?> 249 </label><!-- comments_notify --><br/> 250 251 <label for="moderation_notify"> 252 <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked( '1', get_user_option( 'moderation_notify', $profileuser->ID ) ); ?> /> 253 <?php _e( 'A comment on one of my posts is held for moderation' ) ?> 254 </label><!-- moderation_notify --><br/> 255 256 <label for="moderation_notify_all"> 257 <input name="moderation_notify_all" type="checkbox" id="moderation_notify_all" value="1" <?php checked( '1', get_user_option( 'moderation_notify_all', $profileuser->ID ) ); ?> /> 258 <?php _e( 'Any comment is held for moderation' ) ?> 259 </label><!-- moderation_notify_all --> 260 </fieldset></td> 261 </tr> 262 <?php endif; ?> 263 224 264 <tr class="show-admin-bar"> 225 265 <th scope="row"><?php _e('Toolbar')?></th> 226 266 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Toolbar') ?></span></legend>