1

I have a drupal 9.1.5 site with a custom node type. I can create test content for it using drush by running;

drush genc 1 --bundles=mynode --authors=test

However, half of the content has comments disabled. I think what is happening is that drush is randomly settings the COMMENT SETTINGS field:

enter image description here

Drush has a --skip-fields parameter, but I don't know what to put in there. I've tried a bunch of different things like field_mynode_comment (the machine name of the field) but none seemed to work. I'm basically guessing.

How can I use drush to create nodes that always allow comments?

2
  • Did you try with devel generate ? – miststudent2011 Mar 25 at 16:39
  • 2
    @miststudent2011 – drush genc is Devel Generate. – leymannx Mar 25 at 18:17
1

This is more of a workaround;

I can coerce all nodes to enable comments by running a query like this:

drush sql-query "UPDATE node__field_mynode_comment SET field_mynode_comment_status = 2"

I had a look at the database and found the node__field_mynode_comment table, which has a field_mynode_comment_status column. I found that the nodes with that column set to 2 had comments enabled, so I ran the above query to set it for all nodes, and now all nodes have comments enabled.

Incidentally I also tried creating the nodes with that field name ignored (--skip-fields=field_mynode_comment_status) but that didn't seem to have any effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.