Ticket #1263 (closed defect: wontfix)

Opened 3 years ago

Last modified 2 years ago

Don't notify admins and post_authors of their own comments

Reported by: coffee2code Assigned to: anonymous
Priority: normal Milestone:
Component: Administration Version: 1.5.1
Severity: minor Keywords:
Cc:

Description

Admins (user_level >= 9), and post_authors who comment on their own post, should not be notified of their own comments.

Attachments

bug1263_pluggable-functions.php (0.7 kB) - added by coffee2code on 05/21/05 06:38:13.
bug1263_pluggable-functions2.php (1.0 kB) - added by coffee2code on 05/21/05 06:38:13.

Change History

04/19/05 20:51:55 changed by coffee2code

  • Patch set to No.

04/19/05 20:58:35 changed by coffee2code

  • Patch changed from No to Yes.

04/20/05 03:02:01 changed by mdawaffe

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

+ if ( $comment->user_id == $user->ID $user->user_level >= 9 ) return false;

04/20/05 05:05:06 changed by coffee2code

No, we'd want what the patch has:

if ( $post->post_author == $user->ID $user->user_level >= 9 ) return false;

and not

if ( $comment->user_id == $user->ID $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.

if ( get_settings('disable_self_notification') && ($post->post_author == $user->ID $user->user_level >= 9) ) return false;

04/20/05 09:26:22 changed by mdawaffe

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).

04/20/05 14:41:00 changed by coffee2code

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.

05/21/05 06:38:13 changed by coffee2code

  • attachment bug1263_pluggable-functions2.php added.

10/01/06 01:04:08 changed by Nazgul

  • status changed from new to closed.
  • resolution set to wontfix.

There is a plugin out there which does this: Not-To-Me (http://www.skippy.net/blog/plugins/)