WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 5 months ago

#16995 closed defect (bug)

wp_notify_postauthor() pluggable behavior problem — at Version 1

Reported by: dglingren Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Mail Keywords: has-patch
Focuses: Cc:

Description (last modified by scribu)

In my application a notification must be issued even when an author comments on their own post; this is not allowed by the default WordPress implementation. Lines 1015 - 1025 in function wp_notify_postauthor reject the author's comments and moderations.
Since wp_notify_postauthor is a pluggable function, I can change this behavior by implementing my own function and replacing the default.

However, there is also a redundant test of post authorship in wp-includes/comment.php, function wp_new_comment, around lines 1344 - 1348. This means that my custom wp_notify_postauthor is never called. My specific problem can be solved by commenting out a line of code:

// $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment

A real fix for this problem should move all of the user_id validation rules out of wp_new_comment and put them in wp_notify_postauthor where they can be modified as needed.

Change History (1)

comment:1 @scribu4 years ago

  • Description modified (diff)
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Summary changed from wp_notify_postauthor From: problem and pluggable behavior problem to wp_notify_postauthor() pluggable behavior problem

It's not a good idea to lump two issues in the same ticket.

Please open a new ticket for the first issue.

Note: See TracTickets for help on using tickets.