Closed (fixed)
Project:
Rules
Version:
7.x-2.x-dev
Component:
Rules Core
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Mar 2009 at 05:17 UTC
Updated:
9 Jun 2012 at 20:11 UTC
I'm a bit surprised that there isn't an action to change the comment state (disabled/read/read-write) on a node. I will get around it with custom php, but this should probably be included as it's a common task.
Comments
Comment #1
mitchell commentedMarked #464424: Add action: *publish* comment as a duplicate of this issue.
Comment #2
fivehimself commentedHi RoboPhred,
could you tell me if you managed to get around it by using custom PHP? I'm looking for the same thing here....
Comment #3
RoboPhred commentedI was, but once again my dns server has decided that my url does not exist. Since the site was a subdomain of a multi-site install, I can not access it to copy over the code.
I will try to remember to post it here later once the dns is done with its existential crisis.
Have a look at the api docs for the comment module:
http://api.drupal.org/api/drupal/modules--comment--comment.module/6
Comment #4
detot commentedalso interested in how to solve this
Comment #5
RoboPhred commentedI created a rule set with two arguments: node (node) and enabled (boolean).
This just toggles between read/write and read-only (locked). If you want to disable comments (so no existing comments are visible), check comment.module for the constant to use.
Comment #6
brad.bulger commentedchanging the status of a particular comment is a distinct action from changing the comment status of a node, is it not? are these related as far as the relevant code changes? otherwise #464424: Add action: *publish* comment doesn't really seem like a duplicate issue.
Comment #7
wgrunberg commented@RoboPhred
I am trying to construct a rules action which sets a node's commenting to read only. I have tried your code without success in a rules PHP action but I get the following error:
Parse error: syntax error, unexpected $end, expecting '(' in /drupal6/sites/all/modules/rules/rules/modules/php.rules.inc(107) : eval()'d code on line 1I get the same error with a simplified version too:
I would appreciate any suggestions.
Comment #8
wgrunberg commentedI committed a newbie error in rules' custom PHP action and included the PHP tags. Once I removed them, the code worked very nicely. The PHP tags are apparently reserved for some form of pre-processing before execution.
Comment #9
mitchell commentedThis should be fixed in 7.x. Please reopen if this is a mistake.
Comment #11
sslider999 commentedHello,
If i`m not mistaken, there is no rule in version 7 for changing the node comment settings.
Can this feature be added?
Thanks,
Comment #12
fagoOh, there is an entity property "Comments allowed, node:comment" - at least with recent version of the entity api. With that + the regular data_set action you can do it. I'd be open for adding a separate action though.
Comment #13
mitchell commentedSee also: #1007336: Action: Set comment count new.
Comment #14
mitchell commentedDone, see #1269838-2: Get comment status as data propert.