I have a Rule as follows (I simplified down to this for testing):
Events:
After saving a new comment
After updating an existing comment
Conditions:
Text comparison
Parameter: Text: [comment:comment-body:value], Matching text: bad, Comparison operation: regular expression
Actions:
Show a message on the site
Parameter: Message: Bad stuff here
And this works absolutely fine if the relevant Comment body field is set to "Filtered text" (in admin/structure/types/manage/[content-type]/comment/fields/comment_body). But if I set it to Plain text, nothing happens. I've tried all types of Text comparison operation but nothing ever happens so long as the type is Plain text. Unfortunately I have to have the Comment body set to Plain text so I can't work around the problem with the Filtered text option.
Is this a bug or am I missing something?!
Comments
Comment #0.0
one_orange_cat CreditAttribution: one_orange_cat commentedslight improvement to layout of info!
Comment #1
Pauly Jura CreditAttribution: Pauly Jura commentedI'm trying to do something similar where I check a comment for "bad text" in order to unpublish it. Turning on debugging shows this message:
0 ms Reacting on event After saving a new comment.
7.781 ms Evaluating conditions of rule Filter spam comments. [edit]
8.437 ms Unable to apply data selector comment:comment-body:value. The specified variable is not a list or a structure: Property comment_body.
8.804 ms Unable to evaluate condition text_matches. [edit]
8.822 ms AND evaluated to FALSE.
8.841 ms Finished reacting on event After saving a new comment.
My comments are all plain text also.
Would love to have this fixed soon.
Comment #2
poniesThis might be related. When I do a regex text comparison on node:body:value it works like a charm if the user selected 'Plain text', but fails if they use 'Filtered HTML'.
Comment #2.0
poniesfix to path
Comment #3
TR CreditAttribution: TR commentedPlease read #1281912: Access and Set Comment extra fields - it explains the difference is structure of the comment object when the format is set to plain text vs filtered HTML, and it shows a rule export you can use to set the value of the comment body.
If that does not sufficiently address your problem, please provide more detail along with an export of your rule to show us exactly what you are trying.
Comment #4
TR CreditAttribution: TR commentedNo further information provided.