By nuvious on
I've created a customized contact form (I looked at webforms but you couldn't add cck fields to them) and I've been able to successfully save nodes generated from this form as nodes. Everything works great but comments aren't enabled even though they are by default in the content-type settings. What $node->'variable' do I need to set to enable comments?
Comments
Anyone?
Anyone?
Try $node->comment
Did you try setting $node->comment ='2' for read/write or $node->comment='1' for read only?
I'm just going off of what I saw in the node object structure.
With the Node Comments module I got it to work like this...
If you are using the Node Comments module the following should work for you. This is what worked for me.
This sets the comment settings for nodes of 'mytype' to Read/Write if the author of the node was Anonymous.
I encountered this problem
I encountered this problem today. If anyone else googling for this should end up here, this is my solution (it was drupal 7, but the same applies for d6 i guess):
I used the module Views bulk operations. The easiest way was if VBO had an action already created for enabling comments, but as that wasn’t the case, it is really not a long snippet to execute on each row. Here is the steps I used to achieve what I wanted.
1. Downloaded and enabled views bulk operations
2. Created a view displaying all nodes of the content type I wanted to enable comments on
3. Added a VBO field (this part is slightly different on d6)
4. Enabled the Execute PHP action for this field, and also the “select all nodes” checkbox
5. Added a page display
6. Viewed the view page, selected all nodes and executed the PHP action
7. Entered the following snippet as action
Done!
<?phpnode_object_prepare($ent