4

I'm trying to build a reaction rule that fires on the event After updating existing content, but with the condition to only run after the node has been manually updated using the node edit form, not as part of a Views Bulk Operation action that updates nodes. My issue is I can't find a condition that achieves this.

Does anybody have an idea? Thanks for thinking along :-)

2
  • Not sure there's anything off-the-shelf that would do this. Can you write PHP code? Mar 21, 2013 at 10:20
  • I guess a custom condition (PHP) would be a possibility, but I wouldn't really know what to compare/check for.
    – gazorp
    Mar 21, 2013 at 11:44

1 Answer 1

2

This answer is slightly experimental as I have done something similar but not precisely the same. You may need to do further work, but here's the outline which will require a custom module that uses Entity API. What it does is create a custom node property which says where it was updated from:

  1. Implement hook_node_submit() to check which form the node update has been submitted from and if it's a node_edit, add a custom member item to the node object, eg $node->is_node_edit = TRUE;
  2. Implement hook_entity_property_info_alter() to add a custom property to the node entity type corresponding to the custom member as above.
  3. Implement the getter callback you declared in that hook to be something like:

    function mymodule_node_update_from_edit($data, array $options, $name, $type, $info) { $node = $data; return (boolean)@$node->is_node_edit; }

You can then check the value of the property in a Rules condition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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