wp_notify_postauthor() pluggable behavior problem — at Version 1
|Reported by:||dglingren||Owned by:|
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.