WordPress显示最新评论的插件Wizzart – Recent Comments

I had tried some plugins on showing the recent comments and found that “Wizzart – Recent Comments” is very convient. It has the following features:

  • can show visitor’s gravator
  • can show the title of post which was commented on
  • can show the excerpt of 
  • the truncation of  Chinese sentences works well

At last, I chose to use this plugin, although I had installed lots of plugins.

尝试了些显示最近评论的插件,发现Wizzart – Recent Comments比较好用:

  • 有评论者头像
  • 没有指向评论者的链接
  • 可以显示被评论的文章标题
  • 有评论预览,中文截断没有乱码

于是我采用了这款插件,虽然已经用了不少插件

However, as many other similar plugins, this plugin also shows the comments of  the administrator. This is a waste of resource. This problem can be fixed easily:

Edit the file “wp-content/plugins/wizzart-recent-comments/Wizzart_Recent_Comments_Widget.php”, and find the following code:

$comments_filter .= $comments_types;

$query = “SELECT * FROM $wpdb->comments “;

$query .= $comments_filter;

$query .= ” AND comment_approved=’1′ “;

$query .= “ORDER BY comment_date DESC LIMIT $number”;

$comments = $wpdb->get_results($query);

Then replace the sentence

$query .= ” AND comment_approved=’1′  “;

with

$query .= ” AND comment_approved=’1′ AND user_id !=1 “;

One who is interested in this plugin can have a try.

--

Postscript: The new version (1.3.1) of this plugin supplies an easy way to exclude the comments from the administrator!

但是和多数显示最新评论的插件一样,它也有个毛病--就是把管理员自己的评论也显示出来了,这对资源是个浪费。不过这个问题很快得到了解决:

编辑文件 wp-content/plugins/wizzart-recent-comments/Wizzart_Recent_Comments_Widget.php,找到

$comments_filter .= $comments_types;
$query = “SELECT * FROM $wpdb->comments “;
$query .= $comments_filter;
$query .= ” AND comment_approved=’1′ “;
$query .= “ORDER BY comment_date DESC LIMIT $number”;

$comments = $wpdb->get_results($query);

这一段代码,将其中的

$query .= ” AND comment_approved=’1′  “;

改为

$query .= ” AND comment_approved=’1′ AND user_id !=1 “;

即可以排除掉管理员自己。

有兴趣可以试一试。

---

后记:看来我的想法比作者超前了些。在上面这些内容写了之后一星期作右,作者更新了插件,在新版1.3.1中主要就是加入了可排除管理员自己评论的功能。所以不用如上折腾了,直接拿来用吧。

Related posts



Discussion has just started! Leave a comment

  1. Liao 说道:

    好!我正不知道怎么做呢!回头改插件去了!

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

Comment

You may use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>