Tự động Notify Drupal Authors khi có Comments mới

Tự động Notify Drupal Authors khi có Comments mới

Managing comments on a busy website can get tedious if you need to login and check continually. It's very convenient to get an email with the comment text, so you can see if it's legitimate or comment spam.

To do this in Drupal we're going to use two core modules, Actions and Triggers. We'll also use the Token module to control over the content and recipients for the email

In this tutorial we're going to use Actions, Triggers and Tokens to show you how to automatically send customized emails from Drupal.

Step 1: Install the Token Module

  • You can get the module here: http://drupal.org/project/token
  • Download Token and install from Modules > Add Module.
  • Go to the Modules page and enable the Token module.
  • Also make sure that Trigger module is enabled under the "Core" area of the Modules page.

Step 2. Create an Action

  • Go to Configuration > Actions.
  • Scroll to the bottom to find the selection box.
  • Choose Send e-mail from the selection box at the end of the page.
  • Click Create.
Auto-Notify Drupal Authors About New Comments

Step 3. Fill in the E-mail Recipients

  • Put the cursor in the Recipient box. Leave it there and scroll down the page to see the tokens at the bottom.
tutuploadsmedia_1337057248588.png
  • Click the small gray triangle next to the name Nodes to expand the group.
tutuploadsmedia_1337060828154.png
  • Click the triangle to expand Author.
  • Click the blue link across from Email [node author:mail]
  • There are a lot of tokens, and if you've added additional content types and fields you may have an extensive list.
tutuploadsmedia_1337061508710.png
 
  • The token will be automatically inserted into the Recipient field.
  • If you are familiar with certain tokens, you can type them in, you don't need to locate them on the list.  You could also type in an email address or more than one separated by a semi-colon if you don't want to use a token at all.
tutuploadsmedia_1337061776704.png

Step 4: Fill in the subject and body

tutuploadsmedia_1337071653499.png

When you are finished creating your message, scroll to the bottom of the screen to click Save.

Here's a sample you can copy to the body. You'll find there are quite a few tokens. If you have custom content types and custom fields and additional plugins, the list may be very long. You should plan out which fields you want to use.

 Link: [comment:url]
 On: [comment:created:medium] 
 By: [comment:name] Email: [comment:mail]
 [comment:node]
Comment Title: [comment:title]
[comment:body]
 

Step 5: Create the trigger

tutuploadsmedia_1337064054386.png
  • Go to Structure > Triggers to get access.
tutuploadsmedia_1337064314230.png
  • On the Triggers page go to the Comment Tab..
  • There are several events you can choose from. Each one has a dropdown box.
  • Choose Send e-mail.
  • Click Assign.
  • There is a tab on this page for each module that defines triggers. On this tab you can assign actions to run when triggers from the Comment module happen.
  • You will see your list of assigned actions. In this case we've only defined one action so we only see one.
tutuploadsmedia_1337064612103.png

Step 6: Test the Comment Emails

  • Now go to your site, and comment on an article.
  • Here's a copy of the email generated by the action I created:
tutuploadsmedia_1337071020874.png

Note: You can get more features from additional modules. For.example,

  • Comment Notify: a lightweight tool to send notification e-mails to visitors about new, published comments on pages where they have commented. Comment notify works for both registered and anonymous users.
  • Watcher: offers your site's users, registered and anonymous visitors, a way to easily watch nodes for changes and new comments without having to post themselves.
  • Notify: allows users to subscribe to periodic emails which include all new or revised content and/or comments much like the daily news letters sent by some websites.
  • Subscriptions: enables users to subscribe to be notified of changes to nodes or taxonomies, such as new comments in specific forums, or additions to some category of blog.
  • Notifications: a complete Subscriptions/Notifications Framework aiming at extendability and scalability. It allows any number of plug-ins defining new event types or subscription types or a different user interface.
Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Khanh Hoang

Khanh Hoang - Kenn

Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Facebook gặp “đại hạn” vì bán thông tin người dùng

Facebook gặp “đại hạn” vì bán thông tin người dùng

Mạng xã hội Facebook có thể bị chặn tại nhiều nước vì tiết lộ thông tin cá nhân của thành viên.

Thiết bị kích sóng di động đang được rao bán tràn lan

Thiết bị kích sóng di động đang được rao bán tràn lan

Thiết bị kích sóng di động đang được rao bán tràn lan, thế nên bất cứ ai có nhu cầu cũng có thể dễ dàng sắm về phục vụ cho mục đích cá nhân, không cần biết đó chính là nguyên nhân gây can nhiễu cho mạng viễn thông di động.

COD - Conference Organizing Distribution

Giới thiệu Conference Organizing Distribution phát triển bằng Drupal

COD is a Drupal distribution to create sites for the organization of conventions and events. COD is an acronym from Conference Organizing Distribution.

Công ty diệt chuột T&C

 

Diet con trung