定制 viget/craft-disqus-notify 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

viget/craft-disqus-notify

Composer 安装命令:

composer require viget/craft-disqus-notify

包简介

Notify authors when a comment is added via Disqus.

README 文档

README

Notify authors when a comment is added via Disqus.

Requirements

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require viget/craft-disqus-notify
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Disqus Notify.

Configuring Disqus Notify

  1. Navigate to the plugin settings to customize the email subject and body.

  2. Signup for a Disqus account and configure for your site.

Using Disqus Notify

You will utilize the Disqus onNewComment callback to make an AJAX request to the Disqus Notify plugin.

You need to pass the following pieces of data to the plugin:

  1. Disqus Comment Text
  2. Entry ID
  3. Entry Author ID

The URL that you need to POST to is {{ actionUrl("disqus-notify/notify/notify") }}

Here is an example of the plugin in action utilizing jQuery:

<script>
	var disqus_config = function () {
		this.page.identifier = '{{ entry.id }}';

		this.callbacks.onNewComment = [function(comment) {
			var csrfTokenName = "{{ craft.config.get('csrfTokenName') }}";
			var csrfTokenValue = "{{ craft.request.getCsrfToken }}";
			var data = {
				comment: comment.text,
				entryId: {{ entry.id }},
				authorId: {{ entry.author.id }}
			};
			data[csrfTokenName] = csrfTokenValue;

			$.post('{{ actionUrl("disqus-notify/notify/notify") }}', data);
		}];
	};

	(function() {  // DON'T EDIT BELOW THIS LINE
		var d = document, s = d.createElement('script');

		s.src = '//subdomain.disqus.com/embed.js';

		s.setAttribute('data-timestamp', +new Date());
		(d.head || d.body).appendChild(s);
	})();
</script>

Note: you will need to update your Disqus subdomain in this code snippet.

统计信息

  • 总下载量: 1.13k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 13
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固