Changeset 61179
- Timestamp:
- 11/07/2025 02:05:43 PM (3 months ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
-
wp-admin/includes/schema.php (modified) (1 diff)
-
wp-admin/options-discussion.php (modified) (1 diff)
-
wp-admin/options.php (modified) (1 diff)
-
wp-includes/comment.php (modified) (2 diffs)
-
wp-includes/default-filters.php (modified) (1 diff)
-
wp-includes/pluggable.php (modified) (2 diffs)
-
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/schema.php
r60954 r61179 561 561 // 6.4.0 562 562 'wp_attachment_pages_enabled' => 0, 563 564 // 6.9.0 565 'wp_notes_notify' => 1, 566 563 567 ); 564 568 -
trunk/src/wp-admin/options-discussion.php
r60805 r61179 161 161 <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked( '1', get_option( 'moderation_notify' ) ); ?> /> 162 162 <?php _e( 'A comment is held for moderation' ); ?> </label> 163 <br /> 164 <label for="wp_notes_notify"> 165 <input name="wp_notes_notify" type="checkbox" id="wp_notes_notify" value="1" <?php checked( '1', get_option( 'wp_notes_notify' ) ); ?> /> 166 <?php _e( 'Anyone posts a note' ); ?> </label> 167 163 168 </fieldset></td> 164 169 </tr> -
trunk/src/wp-admin/options.php
r60238 r61179 126 126 'comment_registration', 127 127 'show_comments_cookies_opt_in', 128 'wp_notes_notify', 128 129 ), 129 130 'media' => array( -
trunk/src/wp-includes/comment.php
r61144 r61179 2426 2426 function wp_new_comment_notify_postauthor( $comment_id ) { 2427 2427 $comment = get_comment( $comment_id ); 2428 2429 $maybe_notify = get_option( 'comments_notify' ); 2428 $is_note = ( $comment && 'note' === $comment->comment_type ); 2429 2430 $maybe_notify = $is_note ? get_option( 'wp_notes_notify' ) : get_option( 'comments_notify' ); 2430 2431 2431 2432 /** … … 2448 2449 } 2449 2450 2450 // Only send notifications for approved comments. 2451 if ( ! isset( $comment->comment_approved ) || '1' !== $comment->comment_approved ) { 2452 return false; 2451 // Send notifications for approved comments and all notes. 2452 if ( 2453 ! isset( $comment->comment_approved ) || 2454 ( '1' !== $comment->comment_approved && ! $is_note ) ) { 2455 return false; 2453 2456 } 2454 2457 -
trunk/src/wp-includes/default-filters.php
r61178 r61179 523 523 add_action( 'comment_post', 'wp_new_comment_notify_moderator' ); 524 524 add_action( 'comment_post', 'wp_new_comment_notify_postauthor' ); 525 add_action( 'rest_insert_comment', array( 'WP_REST_Comments_Controller', 'wp_new_comment_via_rest_notify_postauthor' ) ); 525 526 add_action( 'after_password_reset', 'wp_password_change_notification' ); 526 527 add_action( 'register_new_user', 'wp_send_new_user_notifications' ); -
trunk/src/wp-includes/pluggable.php
r61131 r61179 1895 1895 break; 1896 1896 1897 case 'note': 1898 /* translators: %s: Post title. */ 1899 $notify_message = sprintf( __( 'New note on your post "%s"' ), $post->post_title ) . "\r\n"; 1900 /* translators: 1: Note author's name, 2: Note author's IP address, 3: Note author's hostname. */ 1901 $notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 1902 /* translators: %s: Note author email. */ 1903 $notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n"; 1904 /* translators: %s: Note text. */ 1905 $notify_message .= sprintf( __( 'Note: %s' ), "\r\n" . ( empty( $comment_content ) ? __( 'resolved/reopened' ) : $comment_content ) ) . "\r\n\r\n"; 1906 $notify_message .= __( 'You can see all notes on this post here:' ) . "\r\n"; 1907 /* translators: Note notification email subject. 1: Site title, 2: Post title. */ 1908 $subject = sprintf( __( '[%1$s] Note: "%2$s"' ), $blogname, $post->post_title ); 1909 break; 1910 1897 1911 default: // Comments. 1898 1912 /* translators: %s: Post title. */ … … 1918 1932 } 1919 1933 1920 $notify_message .= get_permalink( $comment->comment_post_ID ) . "#comments\r\n\r\n";1921 1934 /* translators: %s: Comment URL. */ 1922 $notify_message .= sprintf( __( 'Permalink: %s' ), get_comment_link( $comment ) ) . "\r\n"; 1923 1924 if ( user_can( $post->post_author, 'edit_comment', $comment->comment_ID ) ) { 1935 if ( 'note' === $comment->comment_type ) { 1936 $notify_message .= get_edit_post_link( $comment->comment_post_ID, 'url' ) . "\r\n"; 1937 } else { 1938 $notify_message .= get_permalink( $comment->comment_post_ID ) . "#comments\r\n\r\n"; 1939 $notify_message .= sprintf( __( 'Permalink: %s' ), get_comment_link( $comment ) ) . "\r\n"; 1940 } 1941 1942 if ( 'note' !== $comment->comment_type && user_can( $post->post_author, 'edit_comment', $comment->comment_ID ) ) { 1925 1943 if ( EMPTY_TRASH_DAYS ) { 1926 1944 /* translators: Comment moderation. %s: Comment action URL. */ -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
r61144 r61179 37 37 } 38 38 39 /** 40 * Send a notification to the post author when a new note is added via the REST API. 41 * 42 * @since 6.9.0 43 * 44 * @param WP_Comment $comment The comment object. 45 */ 46 public static function wp_new_comment_via_rest_notify_postauthor( $comment ) { 47 if ( 'note' === $comment->comment_type ) { 48 wp_new_comment_notify_postauthor( $comment->comment_ID ); 49 } 50 } 39 51 /** 40 52 * Registers the routes for comments.
Note: See TracChangeset
for help on using the changeset viewer.