PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/hicms/includes/top_comment.php

https://github.com/kikaendeavor/wordpress
PHP | 15 lines | 15 code | 0 blank | 0 comment | 4 complexity | fc3d8f697381801970dc20cb3b4127bc MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php if (get_option('swt_type') == 'Display') { ?>
  2. <h3>最活跃的读者</h3>
  3. <ul>
  4. <?php
  5. $counts = $wpdb->get_results("SELECT COUNT(comment_ID) AS cnt, comment_author, comment_author_url, comment_author_email FROM (SELECT * FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->posts.ID=$wpdb->comments.comment_post_ID) WHERE comment_date > date_sub( NOW(), INTERVAL 1 MONTH ) AND user_id='0' AND comment_author_email != '' AND post_password='' AND comment_approved='1' AND comment_type='') AS tempcmt GROUP BY comment_author_email ORDER BY cnt DESC LIMIT 15");
  6. foreach ($counts as $count) {
  7. $a = get_bloginfo('wpurl') . '/avatar/' . md5(strtolower($count->comment_author_email)) . '.jpg';
  8. $c_url = $count->comment_author_url;
  9. $mostactive .= '<li class="mostactive">' . '<a href="'. $c_url . '" title="' . $count->comment_author . ' (留下'. $count->cnt . '个脚印)" target="_blank" rel="external nofollow"><img src="' . $a . '" alt="' . $count->comment_author . '" class="avatar" /></a></li>';
  10. }
  11. echo $mostactive;
  12. ?>
  13. </ul>
  14. <?php { echo ''; } ?>
  15. <?php } else { include(TEMPLATEPATH . '/includes/top_comment2.php'); } ?>