Opened 15 years ago
Closed 14 years ago
#12774 closed enhancement (fixed)
Don't fire wp_notify_postauthor() when the author moderated the comment
Reported by: | nacin | Owned by: | |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
In wp_notify_postauthor(), there is this bit of code with an inline comment:
// The author moderated a comment on his own post if ( $comment->user_id == $post->post_author ) return false;
The comment doesn't match the code. The code actually prevents the e-mail whenever the author *made* a comment on their own post.
That said, the comment should have code for it. If the author moderates a comment on their own post (a comment not written by them, that is), the author should not get a comment notification. Thoughts?
Attachments (2)
Change History (15)
#5
@
15 years ago
Attached my attempt at solving the original ticket's issue. (Assumes the moderator is the current user)
#7
@
14 years ago
- Keywords commit added; needs-testing removed
- Milestone changed from Awaiting Triage to 3.1
#9
@
14 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Didn't notice an issue with the logic in the patch until now:
( $user->user_id == $moderating_uid )
but:
$moderating_uid = (int) $user->id;
This should be:
$moderating_uid = $moderating_user->id;
Or even better, just get_current_user_id(), and we can clean this up a little in terms of standards.
Makes sense.
Also, an admin shouldn't get a comment notification after moderating any comment. (I have a plugin that deals with this: Filter Email Notifications).