-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Use comment status and type to set $maybe_notify default #10489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
eee5a9f
19a8db7
a45b3b4
7c217dd
9adf0e5
d9cb02a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2472,15 +2472,27 @@ function wp_new_comment_notify_moderator( $comment_id ) { | |||||
| */ | ||||||
| function wp_new_comment_notify_postauthor( $comment_id ) { | ||||||
| $comment = get_comment( $comment_id ); | ||||||
| if ( ! ( $comment instanceof WP_Comment ) ) { | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: hereafter in this function, it should really use |
||||||
| return false; | ||||||
| } | ||||||
| $is_note = ( $comment && 'note' === $comment->comment_type ); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks to the above, this can now be simplified:
Suggested change
|
||||||
|
|
||||||
| $maybe_notify = $is_note ? get_option( 'wp_notes_notify', 1 ) : get_option( 'comments_notify' ); | ||||||
| // By default, only notify for approved comments and notes. | ||||||
| if ( '1' !== $comment->comment_approved && ! $is_note ) { | ||||||
| $maybe_notify = false; | ||||||
| } else if ( $is_note ) { | ||||||
| $maybe_notify = get_option( 'wp_notes_notify', 1 ); | ||||||
| } else { | ||||||
| $maybe_notify = get_option( 'comments_notify' ); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Filters whether to send the post author new comment notification emails, | ||||||
| * overriding the site setting. | ||||||
| * Filters whether to send the post author new comment and note notification emails, | ||||||
| * overriding the site settings and defaults. By default, notifications are sent for | ||||||
| * all notes and for approved comments. | ||||||
| * | ||||||
| * @since 4.4.0 | ||||||
adamsilverstein marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| * @since 6.9.0 Comment approval status is checked before this filter. | ||||||
| * | ||||||
| * @param bool $maybe_notify Whether to notify the post author about the new comment. | ||||||
| * @param int $comment_id The ID of the comment for the notification. | ||||||
|
|
@@ -2495,13 +2507,6 @@ function wp_new_comment_notify_postauthor( $comment_id ) { | |||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| // Send notifications for approved comments and all notes. | ||||||
| if ( | ||||||
| ! isset( $comment->comment_approved ) || | ||||||
| ( '1' !== $comment->comment_approved && ! $is_note ) ) { | ||||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| return wp_notify_postauthor( $comment_id ); | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.