twentyfourhoursmedia/comments-work

为Craft CMS 3提供的易于使用的评论插件

1.3.0 2021-02-23 08:46 UTC

README

为Craft CMS 3.x提供的易于使用且直观的评论插件。允许用户在您的内容上发布评论,并在仪表板上进行管理。

文档

请参阅我们的在线文档资源了解更多信息

Comments Work概览

  • 将用户评论添加到任何类型的元素中,例如用户和内容项
  • 在CP中获取提交的评论的精美概览
  • 管理:在CP中删除、批准或标记为垃圾邮件
  • 管理:在CP中修改评论内容
  • 评论表单已签名,恶意用户无法提交任意内容的评论

使用方法

以下是前端代码的快速示例。更多信息请参阅

{# @var commentsWork \twentyfourhoursmedia\commentswork\services\CommentsWorkService #}
{% set commentsWork = craft.commentsWork.service %}

<div id="comments">
    <br/>
    <p>{{  commentsWork.countComments(entry) }} comments</p>

    {% set comments = commentsWork.fetchComments(entry, 0, 10) %}
    {% for comment in comments %}
        {# @var comment \twentyfourhoursmedia\commentswork\models\CommentModel #}
        <div class="card card bg-light">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-2">
                        <img src="https://image.ibb.co/jw55Ex/def_face.jpg" class="img img-rounded img-fluid" width="64">
                        <p class="text-secondary text-center">{{ comment.dateCreated | date }} {{ comment.dateCreated | date('H:i') }}</p>
                    </div>
                    <div class="col-md-10">
                        {%- if comment.user %}<p><a href="https://maniruzzaman-akash.blogspot.com/p/contact.html"><strong>{{ comment.user.friendlyName }}</strong></a></p>{% endif -%}
                        {%- if comment.title is not empty %}
                            <p><strong>{{ comment.title }}</strong></p>
                        {% endif -%}
                        {%- if comment.comment is not empty %}
                            <p>
                                {{ comment | commentAsHtml }}
                            </p>
                        {% endif -%}
                    </div>
                </div>
            </div>
        </div>
        <br/>
    {% endfor %}
</div>

要求

此插件需要Craft CMS 3.0或更高版本,并且与PRO版配合使用效果最佳。(其他版本不支持用户)

安装

要安装此插件,请遵循https://io.24hoursmedia.com/comments-work/installation中的说明

配置Comments Work

有两种配置选项。在管理CP中,转到“设置”->“Comments Work”。更多信息请参阅https://io.24hoursmedia.com/comments-work/configuration

  • “自动批准评论” - 如果启用,评论将立即在网站上显示。这绕过了管理。当启用匿名评论时,不建议使用!
  • “允许匿名评论” - 允许匿名用户发布评论。

24hoursmedia提供

标志由https://www.iconfinder.com/ReactiveDoodlesApp设计