Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/wp-admin/includes/schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,6 @@ function populate_options( array $options = array() ) {

// 6.9.0
'wp_notes_notify' => 1,

);

// 3.3.0
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/options-discussion.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
<?php _e( 'A comment is held for moderation' ); ?> </label>
<br />
<label for="wp_notes_notify">
<input name="wp_notes_notify" type="checkbox" id="wp_notes_notify" value="1" <?php checked( '1', get_option( 'wp_notes_notify' ) ); ?> />
<input name="wp_notes_notify" type="checkbox" id="wp_notes_notify" value="1" <?php checked( '1', get_option( 'wp_notes_notify', 1 ) ); ?> />
<?php _e( 'Anyone posts a note' ); ?> </label>

</fieldset></td>
Expand Down
15 changes: 14 additions & 1 deletion src/wp-includes/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -2427,7 +2427,7 @@ function wp_new_comment_notify_postauthor( $comment_id ) {
$comment = get_comment( $comment_id );
$is_note = ( $comment && 'note' === $comment->comment_type );

$maybe_notify = $is_note ? get_option( 'wp_notes_notify' ) : get_option( 'comments_notify' );
$maybe_notify = $is_note ? get_option( 'wp_notes_notify', 1 ) : get_option( 'comments_notify' );

/**
* Filters whether to send the post author new comment notification emails,
Expand Down Expand Up @@ -2458,6 +2458,19 @@ function wp_new_comment_notify_postauthor( $comment_id ) {
return wp_notify_postauthor( $comment_id );
}

/**
* Send a notification to the post author when a new note is added via the REST API.
*
* @since 6.9.0
*
* @param WP_Comment $comment The comment object.
*/
function wp_new_comment_via_rest_notify_postauthor( $comment ) {
if ( 'note' === $comment->comment_type ) {
wp_new_comment_notify_postauthor( (int) $comment->comment_ID );
}
}

/**
* Sets the status of a comment.
*
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@
// Email notifications.
add_action( 'comment_post', 'wp_new_comment_notify_moderator' );
add_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
add_action( 'rest_insert_comment', array( 'WP_REST_Comments_Controller', 'wp_new_comment_via_rest_notify_postauthor' ) );
add_action( 'rest_insert_comment', 'wp_new_comment_via_rest_notify_postauthor' );
add_action( 'after_password_reset', 'wp_password_change_notification' );
add_action( 'register_new_user', 'wp_send_new_user_notifications' );
add_action( 'edit_user_created_user', 'wp_send_new_user_notifications', 10, 2 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ public function __construct() {
$this->meta = new WP_REST_Comment_Meta_Fields();
}

/**
* Send a notification to the post author when a new note is added via the REST API.
*
* @since 6.9.0
*
* @param WP_Comment $comment The comment object.
*/
public static function wp_new_comment_via_rest_notify_postauthor( $comment ) {
if ( 'note' === $comment->comment_type ) {
wp_new_comment_notify_postauthor( $comment->comment_ID );
}
}
/**
* Registers the routes for comments.
*
Expand Down
Loading