Advertisement
Guest User

Untitled

a guest
Jul 11th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. add_filter ('preprocess_comment', 'check_comment_trolls');
  2.  
  3. function check_comment_trolls($data) {
  4. // based on the code from the WordPress plugin impostercide
  5. // http://wordpress.org/extend/plugins/impostercide/
  6. // authors Mika Epstein and Scott Merrill
  7.  
  8. extract ($data);
  9.  
  10. if ('' != $comment_type) {
  11. // it's a pingback or trackback, let it through
  12. return $data;
  13. }
  14.  
  15. get_currentuserinfo();
  16.  
  17. if ( is_user_logged_in() ) {
  18. // It's a logged in user, so it's good.
  19. return $data;
  20. }
  21.  
  22. // array of valid users and their email username => email
  23. $valid_users = array(
  24. 'keesiemeijer' => 'keesiemeijer@email.com',
  25. 'gariusthebrit' => 'gariusthebrit@email.com'
  26. );
  27.  
  28. if(array_key_exists( $comment_author, $valid_users)) {
  29. if($comment_author_email != $valid_users[$comment_author]){
  30. // add comment to moderation queue
  31. add_filter('pre_comment_approved', '__return_zero');
  32. }
  33. }
  34. return $data;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement