Possible Duplicate:
Top Commenters: exclude admin
回来的时候,我在这里发现了这个黑客来显示顶级评论。它工作得很好。但是我想从评论列表中排除管理员。所以请帮助修改代码以排除管理员谢谢。
代码为:
function top_comment_authors($amount = 5) {
global $wpdb;
$results = $wpdb->get_results(\'
SELECT
COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url
FROM
\'.$wpdb->comments.\'
WHERE
comment_author_email != "" AND comment_type = "" AND comment_approved = 1
GROUP BY
comment_author_email
ORDER BY
comments_count DESC, comment_author ASC
LIMIT \'.$amount
);
$output = "<ul>";
foreach($results as $result){
$output .= "<li>".(($result->comment_author_url) ? "<a href=\'".$result->comment_author_url."\'>" : "").$result->comment_author.(($result->comment_author_url) ? "</a>" : "")." (".$result->comments_count.")</li>";
}
$output .= "</ul>";
echo $output;
}