Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter ('preprocess_comment', 'check_comment_trolls');
- function check_comment_trolls($data) {
- // based on the code from the WordPress plugin impostercide
- // http://wordpress.org/extend/plugins/impostercide/
- // authors Mika Epstein and Scott Merrill
- extract ($data);
- if ('' != $comment_type) {
- // it's a pingback or trackback, let it through
- return $data;
- }
- get_currentuserinfo();
- if ( is_user_logged_in() ) {
- // It's a logged in user, so it's good.
- return $data;
- }
- // array of valid users and their email username => email
- $valid_users = array(
- 'keesiemeijer' => 'keesiemeijer@email.com',
- 'gariusthebrit' => 'gariusthebrit@email.com'
- );
- if(array_key_exists( $comment_author, $valid_users)) {
- if($comment_author_email != $valid_users[$comment_author]){
- // add comment to moderation queue
- add_filter('pre_comment_approved', '__return_zero');
- }
- }
- return $data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement