Stopping Anonymous Posting

By default WordPress allows anyone to add comments to a message. This would be nice, except that the spammers abuse it and add spam to every single posting. This simple snippet of code added to the wp-comments-post.php file, after the check for require_name_email, will require posters to first be logged in.

# Require user to be registered and logged in before allowing posting
# 30 second hack by Brian C. Lane - www.libertynews.org
get_currentuserinfo();
if( empty($user_nickname) && empty($user_email) )
die( __('Error: You must be logged in before you can post') );

this posting has a couple of similar methods that block the comment posting form (but to block actual posting you need my hack).

Comments (2) to “Stopping Anonymous Posting”

  1. [...] mous commenting and I found it! Have a look at http://wordpress.org/support/10/7663 and http://www.libertynews.org/index.php?p=7. These hacks allow only registered users to post comments whic [...]

  2. [...] mous commenting and I found it! Have a look at http://wordpress.org/support/10/7663 and http://www.libertynews.org/index.php?p=7. These hacks allow only registered users to post comments whic [...]