Thanks for this page. I'm still on Drupal 6, and finally decided to get off my butt and get comment email notification working. I found your page, and got it working with no problems! Thanks!
Disclaimer: Accessing the information on this page means you agree to the Sites Terms of Service
Back in the Drupal 5 days, there was a wonderfully made little module called: Comment Mail that would e-mail the site administrator if there were any new comments on the site needing approval. While there is a D6 version of the module, it has not been maintained since Nov 2008 and even posts that there are some bugs with the module. This inspired me to figure out a way of doing the same thing with a few other modules. While I believe the way I have devised is a bit overkill, it does the job :)
Now, some may be saying "Why not just use Drupal 6 Actions and Triggers?" The reason is because it doesn't really give any usable support for tokenized messages... (D7 is supposed to be different... I hope...) Since the "Token Actions" for Drupal... well... completely sucks, I decided to use the Rules module instead which pulls the full functionality of the Token module into play... Top it off with the LoginToboggan module and you are ready for comment approval e-mails to start flooding in! There is another post on JasonHooker.com which gives great instructions on how to setup the rules module to do all of this, but he didn't go into detail on how to really make the e-mail message shine. This is where I want to kind of pickup where he left off... I will explain how to set everything up from start to finish, but if you need some help with the rules, you might check his site.
Modules needed:
Suggested Modules:
First off, the Rules module is VERY powerful in what it can do with Drupal... It might seem a bit intimidating but don't let it scare you. After you make a few rules, it's one of those "Ooohh... I see what they're doing!" scenarios.
The Token module is a passive module meaning there aren't any configuration screens for it. If another module needs it and it's there, you get a list of tokens to use. That simple. Chances are, if you are using Pathauto, you are already using the Tokens module.
The (optional) LoginToboggan is more a site where there are a lot of users, but there is one little itty-bitty setting that needs to be turned on for everything to come together smoothly.
Leave the check next to: This rule is active and should be evaluated when the associated event occurs.
Weight: (You can leave at 0)
Click the Save changes button.
You should now see a screen that shows:
ON event After saving a new comment
+ Add Action
DO
+ Add Action
Click Next
A new comment has been posted on: [comment:site-url] at the following location: [comment:site-url]/node/[comment:comment-nid]#comment-[comment:comment-cid]
Approve the comment:
[comment:site-url]/admin/content/comment/approval
Name: [comment:comment-author-name-raw]
Email: [comment:comment-author-mail-raw]
Homepage: [comment:comment-author-homepage]
Subject: [comment:comment-title-raw]
Message:
[comment:comment-body-raw]
Weight: (Just leave at 0)
Click Save
Scroll all the way to the bottom to the Other section and set the following:
Present login form on access denied (403): Enable
Note: If you have multiple users that login to your site, you might want to go through the LoginToboggan settings a little more in-depth to make sure the login & registration process is to your liking.
---
That's It! Go send yourself a comment and test it out! : )
If you want to customize the e-mail message, feel free to play around with the different tokens available. What I have presented is probably enough information for most folks... Keep in mind though, that the actual comment URL won't work right until the comment has been approved.
Update: 2010/02/21 It was brought to my attention that Token Actions will allow you to create an advanced action as "send tokenized email..." using the core Drupal Triggers / Actions. While I suppose this could be used to construct the above Rules, I personally have not tested it's output to see if the e-mail generation is similar to the Rules option above. Theoretically though, it should work pretty much the same.
Thanks for this page. I'm still on Drupal 6, and finally decided to get off my butt and get comment email notification working. I found your page, and got it working with no problems! Thanks!
You said: "Token Actions" for Drupal... well... completely sucks.
What's wrong with Token Actions?
What can you do with Rules that you cant to with Actions/Triggers and Token Actions?
Thanks for the response and for sharing your example. This has helped me. I opted to go for Action/Triggers/Token Actions though just because I wanted to stick to the core Drupal modules as much as possible (Trigger/Actions) and I heard that Token/Token Actions will be included Drupal 7 core.
In case it will help others, here's my Trigger/Action configuration that worked for me:
Action: Send tokenized comment notification e-mail
Recipient: [site-mail]
Subject: [[site-name]] New Comment for Approval
Message:
A new comment has been posted on your [type-name]:
"[title]" at:
[site-url]/node/[comment-nid]#comment-[comment-cid]
Comment information:
"[comment-title]"
Submitted by [comment-author-name] on [comment-ddd], [comment-mm]/[comment-dd]/[comment-yyyy]
[comment-body-raw]
Please review the comment approval queue at:
[site-url]/admin/content/comment/approval
Just add this action to the trigger:
"After saving a new comment"
That's it.. I like the simplicity as well.
Sorry for the confusion - the em tag was supposed to be just for this comment i'm posting :) to highlight the actual text i had in there for the tokenized message text box. thought those are part of your "allowed html tags". just ignore that and use everything in between for the message.
Post Comment