Action called when a comment is marked as spam?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Action called when a comment is marked as spam?

David Anderson-29
Hi,

I'm looking at collecting IP information on my servers for IP addresses
that send comment spam.

Looking in the hooks database at http://adambrown.info/p/wp_hooks and
with some Googling, it looks like the comment_post action is the best
place to hook. I'd then need to check the comment status (see if it's
spam), and that's about it. If I understand rightly, all plugins (like
Akismet) that can mark a comment as spam, will have done their work by
this point.

Does that sound right?

Many thanks,
David

--
UpdraftPlus - best WordPress backups - http://updraftplus.com
WordShell - WordPress fast from the CLI - http://wordshell.net

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: Action called when a comment is marked as spam?

Per Søderlind
Hi David,

You can get this information from $wpdb->comments. In my plugin, http://wordpress.org/plugins/wp-denyhost/, I do:

                $suspect = $this->get_IP();
                $count = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(comment_ID) FROM $wpdb->comments  WHERE comment_approved = 'spam' AND comment_author_IP = '%s'",$suspect) );


../Per

--
Per Søderlind
Web: soderlind.no, Twitter: @soderlind, LinkdIn: linkedin.com/in/soderlind



On 12. sep. 2014, at 11:12, David Anderson <[hidden email]> wrote:

> Hi,
>
> I'm looking at collecting IP information on my servers for IP addresses that send comment spam.
>
> Looking in the hooks database at http://adambrown.info/p/wp_hooks and with some Googling, it looks like the comment_post action is the best place to hook. I'd then need to check the comment status (see if it's spam), and that's about it. If I understand rightly, all plugins (like Akismet) that can mark a comment as spam, will have done their work by this point.
>
> Does that sound right?
>
> Many thanks,
> David
>
> --
> UpdraftPlus - best WordPress backups - http://updraftplus.com
> WordShell - WordPress fast from the CLI - http://wordshell.net
>
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers