Hello,

I am trying to use the Rules module to send an e-mail to a user when a comment is published. In the token list for the e-mail I see several available tokens for the Comment Driven module:

[comment:comment-driven-diff-table] Diff summary of driven changes made by the comment (HTML table)
[comment:comment-driven-diff-ulist] Diff summary of driven changes made by the comment (HTML ul/li)
[comment:comment-driven-diff-crlf] Diff summary of driven changes made by the comment (plain text with \r\n aka CRLF)
[comment:comment-driven-diff-lf] Diff summary of driven changes made by the comment (plain text with \n aka LF)
[comment:comment-driven-diff-cr] Diff summary of driven changes made by the comment (plain text with \r aka CR)

I also have the HTML mail plugin, so mail drupal sends will filter for HTML. Therefore either the first two should work properly. However, none of the above tokens function. The space where I typed the token is completely blank.

I have plenty of other tokens and HTML working with rules and HTML mail. Does anybody have any ideas or suggestions?

Thank you.

Comments

arhak’s picture

please, enable the comment_driven_inspect module,
then navigate to a comment page, hover the diff table to see the "driven inspect" link and click on it
it will take you to a page where you'll see comment_driven's tokens for that comment

are they working there?

mehoo462’s picture

The tokens do seem to be working.

I clicked all 3 options, (plain text, HTML unordered list, and HTML table) and then clicked Inspect. Then on the bottom of half of the page where it says "tokens" i see the values as I would expect them to be.\

Is it possible that the token text listed in on the rules page is incorrect?

mehoo462’s picture

Okay, i figured out what the problem is here:

The rule that sends my e-mail is a Triggered Rule. The trigger event is "after saving a new comment."

The problem is Drupal's order of operations:
1) Save the comment
2) Trigger the rule and fire off the e-mail.
3) Update node per comment_driven

So as you can see when the e-mail is fired (and when the token is checking the database) there is no diff. table for the token to read. Thus the token is blank.

Rules also provides a trigger option "after a comment is published." It seems like "publish comment" would be number 4 on the order of operations, thus that option would work, but alas setting that trigger didn't make a difference. (i didn't test this as thoroughly as I'd like due to time constraints)

So anyway. This seems like quite a mess. 3 or 4 different modules interacting here to cause this problem. But really this seems like a question of when comment_driven creates the diff. table in relation to the triggers that are available in Rules.

Any assistance would be greatly appreciated. This is a pretty important functionality for my site.

Thank you.

arhak’s picture

I really don't know what would be a possible solution here
this module is actually saving the comment first and then updating the node
if the used trigger goes on comment save, then the diff table won't be ready yet
OTOH if the trigger goes on node update, then a lot of nodes not being updated via cdriven will get in

I would like to heard some ideas regarding how to deal with this

arhak’s picture

Title: Tokens for Driven Properties Diff Summary return Empty » Problem using Rules Module to send e-mail updates on Comment_Driven changes.
arhak’s picture

Priority: Normal » Major
leon85321’s picture

yea, i am having the same exact problem with rules and workflow and comment driven, it seems that rules are processed before the comment driven update the node.

If anyone can help change the process order will be great! At least put the comment driven processed before the rule take action!

sdsheridan’s picture

What about having a comment_driven rules interface that creates an event for "After saving a new comment-driven comment"? Not a rules expert, but doesn't seem like that would be all that hard, does it?

Shawn

arhak’s picture

that creates an event for "After saving a new comment-driven comment"?

IMO, that would be a hacky workaround

most likely the order in which operations are performed should be inverted
related to #998962: When will CCK fields be updated? and #974938: Use with Team Notifications sends 2 messages, one for the comment and one for updated node

jaspher’s picture

I had the same problem. What I did was to have Rules send the email "After updating existing content". Let me know if it worked out for you...

alex.skrypnyk’s picture

Sorry for hijacking this thread, but may be helpfull:
I have cck_comment and same problem. Changing to 'After publishing comment' helped.