Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: topcommenters
- */
- ?>
- <?php get_header(); ?>
- <div class="middle_single">
- <div class="post_blog">
- <div style="clear:both"></div>
- <div class="entry_blog">
- <?php
- global $wpdb;
- $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'");
- if($comments){
- foreach($comments as $comment){
- $coment_email[] = $comment->comment_author_email;
- }
- $best_commenters = array_count_values($coment_email);
- arsort($best_commenters);
- foreach($best_commenters as $email => $value){
- $comment_author= $wpdb->get_results("SELECT comment_author FROM $wpdb->comments WHERE comment_approved = '1' AND comment_author_email = '".$email."' ");
- echo '<p>comments: '.$value.'<br />comment author: '.$comment_author[0]->comment_author.'<br />comment email: '.$email.'</p>';
- }
- } else { echo 'there are no comments'; }
- ?>
- </div>
- <div style="clear:both;"></div>
- </div>
- </div>
- <?php include(TEMPLATEPATH . '/sidebar-single.php'); ?>
- <?php get_footer();?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement