0

I want to copy a list of nodes, create one copy of each node, and at the same time, reset the contents of two fields on each new copy node.

I am using Views Bulk Operations to select the nodes, and Replication with Replication UI to make copies of them.

I think I should be able to reset the two fields on my new copy nodes just with Rules, but I've been unable to work out a Rule that actually works, and several widely linked resources that refer to using VBO with Rules seem to have been deleted recently.

  • another way would be to login to the database and empty the fields over there. – No Sssweat Oct 6 '15 at 2:59
  • I'm trying to create a system that the site manager can use on her own without my assistance. Ideally I want just one button that does it all... – Victoria Oct 6 '15 at 9:52
0

In my opinion is easier if you write the code in a custom module. You should create a custom form with form api with a button that call a function that select the nodes with db_select and after does the operations, copy :

// Load a node
$node = node_load(1);

// unset version and node id's
unset($node->nid);
unset($node->vid);
unset($node->path);

and unset values of the two fields for each node and save node

unset($node->field1);
unset($node->field2);
node_save($node);

After create a custom block and in block_view load the custom form.

0

I was trying to fire my Rule on the 'after replication' event supplied by Replication module, but it appears that event doesn't do what you'd think. My rule wasn't firing at all.

I fired my rule on node creation instead and in the end that worked fine with VBO, although I did consider using a component.

I asked about this on drupal.org and got some helpful comments which I link here in case they are valuable to anyone else. https://www.drupal.org/node/2254055

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.