I need to do a simple thing. Write a rule that edits some elements of the node, as soon as it is created. Unfortunately Drupal doesn’t like that and crashes whenever you try to save the node within a rule that was triggered by "After saving new content".
Event: After saving new content
Conditions: ...
Actions: Set a data value, with Parameter: Data: [node:field-workflow...], Value: 1
The above results in:
PDOException: SQLSTATE[23000]: Integrity constraint violation:
So far I managed to walk-around that with hook_forms, changing the workflow in my portal (so I never have to edit the node just after it is created)
Things get really interesting when I try to use "Execute custom PHP code" action which will change the node value I want:
- node_save will result in drupal crushing
- db_update - seems to work most of the time...
- db_insert - sometimes works (works for superuser only)
Unfortunately all my hacks don't work for all my problems. Anyone has any idea how else I can address this situation?