Opened 20 years ago
Closed 18 years ago
#1263 closed defect (bug) (wontfix)
Don't notify admins and post_authors of their own comments
Reported by: | coffee2code | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 1.5.1 |
Component: | Administration | Keywords: | |
Focuses: | Cc: |
Description
Admins (user_level >= 9), and post_authors who comment on their own post, should not be notified of their own comments.
Attachments (2)
Change History (8)
#4
@
20 years ago
No, we'd want what the patch has:
$user->user_level >= 9 ) return false; |
and not
$user->user_level >= 9 ) return false; |
$user->ID is the ID of the logged-in person who posted the comment, which is the same as $comment->user_id, so it'd always be equal. What the comparison is doing is seeing if the author of the post is the person currently logged-in/commenting.
---
Also, I opted not to pursue an e-mail based solution because the admin's e-mail may well be known. Spammers could scrape the e-mail from the site (or try to) and make comments using the admin's e-mail, which if used as the non-nontification trigger might mean the admin won't realize the site has been spammed without actually checking the site or the admin comment listings (assuming the spam got through spam filters).
---
Personally, I think self-notification e-mails should be disabled by default. The notification functions can be overridden by plugins which could active the self-notifications for those who want it. Or the behavior could be controlled by an option, i.e.
$user->user_level >= 9) ) return false; |
#5
@
20 years ago
Then I'm confused:
$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1");
Isn't $user->ID always equal to $post->post_author by definition of the SQL query? User seems to refer to the author of the post, not the currently logged in user (which is defined in $comment).
#6
@
20 years ago
Yeah, you're right. I had it in my mind that $user was set to the return value of get_userdata, as per the usual convention. I've attached the fix as bug1263_pluggable-functions2.php. It required obtaining the currentuser info instead of just a variable change. I also inserted it at a point where it saves the query to the user table if the commenter is an admin/post_author.
#7
@
18 years ago
- Resolution set to wontfix
- Status changed from new to closed
There is a plugin out there which does this: Not-To-Me (http://www.skippy.net/blog/plugins/)
Sending a "notification" email also provides a backup. I find it handy (though I backup the database for real and have never had to use it). It's not a big deal to me either way.
The bug report does beg the question, however: Why not set up an email filter to delete (or whatever) any self comments? The patch takes away options while the filter just sucks up some processor ticks and bandwidth.
Since the function can be replaced by a plugin, why not just go that route instead? Or patch in a hook.
At any rate, shouldn't the patch read:
+ Don't notify admin or post_author about their own comment