Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: topcommenters
  4. */
  5. ?>
  6.  
  7. <?php get_header(); ?>
  8.  
  9. <div class="middle_single">
  10. <div class="post_blog">
  11. <div style="clear:both"></div>
  12. <div class="entry_blog">
  13.  
  14. <?php
  15. global $wpdb;
  16. $comments = $wpdb->get_results("SELECT comment_author_email FROM $wpdb->comments WHERE comment_approved = '1' AND comment_date >= '2011-06-01' AND comment_date < '2011-07-01'");
  17. if($comments){
  18. foreach($comments as $comment){
  19.  
  20. $coment_email[] = $comment->comment_author_email;
  21. }
  22. $best_commenters = array_count_values($coment_email);
  23. arsort($best_commenters);
  24. foreach($best_commenters as $email => $value){
  25. $comment_author= $wpdb->get_results("SELECT comment_author FROM $wpdb->comments WHERE comment_approved = '1' AND comment_author_email = '".$email."' ");
  26. echo '<p>comments: '.$value.'<br />comment author: '.$comment_author[0]->comment_author.'<br />comment email: '.$email.'</p>';
  27. }
  28. } else { echo 'there are no comments'; }
  29. ?>
  30. </div>
  31. <div style="clear:both;"></div>
  32. </div>
  33. </div>
  34. <?php include(TEMPLATEPATH . '/sidebar-single.php'); ?>
  35. <?php get_footer();?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement