I am trying to prevent guests (not users) from posting comments on one single page if they fill in the same email address. My further goal is to collect their unique addresses for a contest (The best comment of...).
I am thinking of writing some code to check if the current poster's email address is already inserted in the comments table before actually inserting the comment. Checking the email existence is pretty clear to me (get_comments()
) but I can't think of a proper hook to fire my check. The wp_insert_comment
hook would run my code after the comment was inserted.
Any idea pls, on this? Thanks!
Later edit:
I have found myself a solution with preprocess_comment
filter...