Closed (fixed)
Project:
Views Bulk Operations (VBO)
Version:
6.x-1.x-dev
Component:
Actions
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
4 Jan 2010 at 15:08 UTC
Updated:
17 Mar 2013 at 09:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
infojunkieThere is currently no action that lets you change the commenting status. You can contribute it or mark this issue as a feature request.
Comment #2
infojunkieHere's a recipe to achieve this:
* In Administer > Site configuration > Actions, create a new advanced action of type "Execute arbitrary PHP script".
* In the "PHP script" section, type:
* Save the new action under a descriptive name.
* In your VBO admin page, select the new action in the style settings.
* Save the updated VBO and navigate to its page.
* Select a few nodes and apply the new action to them.
Note that you can choose to disable comments (COMMENT_NODE_DISABLED), make them read-only (COMMENT_NODE_READ_ONLY) or read-write (COMMENT_NODE_READ_WRITE).
Hope this helps!
Comment #4
JamieR commentedThat was awesome. Thank you.
Comment #5
michelleIt's great that there's a recipe for this but I'm wondering if there's some reason it can't be included with VBO to begin with? This seems like a pretty common operation.
Thanks,
Michelle
Comment #6
infojunkieI'd be grateful if someone could package this recipe as a configurable action, allowing to choose which commenting option to apply.
Comment #7
gpk commented#2 works well, many thanks.
Comment #8
bisuteria commentedThank you very much Mr. Karim Ratib
I will save many hours of work.
Comment #9
shopdogg commented+1 for this feature.
Comment #10
hixster commentedSubscribe
Comment #11
chrisdbarnett commentedThis really should be included as a standard action in Drupal.
It's not nice to wade through bad code examples to eventually find the right one.
Hat tip to info Junkie for the working code example.
Comment #12
Anonymous (not verified) commentedAwesome! Thanks Todd Nienkerk for asking and Infojunkie for the great resolution!
Comment #13
infojunkieComment #14
infojunkieSorry, wrong move :-)
Comment #15
tammo commentedGreat, thank you very much. Saved me an evening of work...
Comment #16
Vote_Sizing_Steve commented#2 works well, but I'm still casting a vote for #6.
Comment #17
todd nienkerk commentedThe attached patch introduces an action to change the comment setting on a node. I left a stub validation function in case it's necessary for reasons I don't understand.
Comment #18
todd nienkerk commentedAccidentally checked out the 6.x-3.x branch. I tested the patch against 6.x-1.x, and it works.
Comment #19
todd nienkerk commentedRe-rolled to work with 6.x-1.x branch. (Turns out this branch lists each of the actions files instead of parsing the folder.)
Comment #20
alexmoreno commenteddo you know if does not work with nodecomment???
Comment #21
alexmoreno commentedfor anyone interested, possible solution (via sql hacking):
http://drupal.org/node/164393#comment-4403834
Comment #22
edbradburn commentedI have just set this up using Views Bulk Operations and Rules.
For information on how to link VBO with Rules, there is an excellent video from Nodeone.se: http://dev.nodeone.se/en/blog/nodeone-talks-drupal-rules-vbo-revisited#c....
Basically, you set up a rule set (it's a Component, not a "normal" Rule) with the required action and then add a new View with a VBO field to enable the action to be performed.
It took me all of 5 minutes, the two tools really are very powerful indeed.
The rule action by the way is "Set a data value" and the target is the data item "[node-comments:comment]". The value of this data item gets set to either 0, 1 or 2 depending on whether you want no comments, comments, or read-only comments (in that order).
If you need any help, mail me. I'm a Drupal newbie (although I have a background in IT, PHP and databases) but I seem to have worked this out so far (I'm still stunned how far Drupal has come in the five years I have been away from it).
Comment #23
bojanz commentedChanging back to 6.x-1.x since there's a patch that might be considered for that branch.
Thanks for the tip, edbradburn!
Comment #24
jjbell commented#2 looks like it will accomplish what I am trying to do but "Execute arbitrary PHP script" does not appear in the drop down menu at "Administer > Site configuration > Actions" in Drupal 7. Any ideas?
I have enabled PHP filter (which I assume is needed) and also checked permissions.
Comment #25
bojanz commentedThe VBO for D7 can do this out of the box with tomorrow's -dev, using the "Modify entity values" action.
Comment #26
goron commentedThe patch from #19 for 6.x-1.x works for me. However, it's missing comment blocks for all of the functions, and includes a commented out function. Needs coding standards work.
Comment #27
goron commentedActually it seems that the 1.x branch now doesn't list the available actions in a file, but detects them automatically, so the patch in #17 is the one to use for the 1.x branch.
Coding standards issues still apply.
Comment #28
goron commentedSorry, one more change. The action files are now located in the actions folder. So slight change to the patch. This one will apply cleanly to 1.x-dev and place the new action in the right location.
Comment #29
Encarte commentedComment #30
infojunkieCommitted to latest dev with slight changes.
Note to action authors: On the action form, don't forget to read the default values from the
$contextarray. This is essential in two cases:* If a validation error occurs on the form, values are not lost when the form is re-displayed.
* If the user saves your action with preset arguments (in the "Advanced actions" section of admin/settings/actions/manage), preset arguments are automatically used in the VBO (or anywhere that the saved action is used.)
Comment #31
infojunkieAny interest for D7?
Comment #32
bojanz commentedSee #25. This is possible in D7 with the "Modify entity values" action (included since RC1).
I think that's enough (plus, Rules can be used as well, if the user just hates that action).
Comment #34
MakeOnlineShop commentedHello,
I couldn't manage to use VBO to disable comments on some nodes, cam you help me more ?
Thanks.