Closed (fixed)
Project:
Drupal core
Version:
6.9
Component:
taxonomy.module
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
7 Mar 2009 at 01:21 UTC
Updated:
6 Aug 2009 at 16:04 UTC
I wrote a trigger to change the created time of a node to the current time as follows:
$node->created = time();
node_save($node);
When the trigger is executed, a warning is shown:
* user warning: Duplicate entry '163-117' for key 1 query: INSERT INTO term_node (nid, vid, tid) VALUES (115, 117, 163) in /rootdoc/modules/taxonomy/taxonomy.module on line 694.
Even though the warning is shown, data are saved as expected. What I want to do is to shut off the warning. How do I do that?
Am I using node_save($node) correctly?
I'm using Drupal 6.10, Workflow 6.x-1.1
thx!
Comments
Comment #1
ainigma32 commentedI'm not 100% sure but if you are using the core actions and triggers, I believe you can leave out the call to node_save all together.
That's because the $node object is passed by reference. It also explains the warning: you save the node (and some taxonomy terms) and then once all the actions have been invoked, the node module saves the node as well using the same taxonomy term information.
Please post back how that works out for you.
- Arie
Comment #2
xn2001 commentedNo, you can't leave out the call to node_save all together. I tried with the core action "Publish post" and it needs "Save post" action which is basically doing what node_save() is doing.
Comment #3
xn2001 commentedClose this issue. No longer need to use triggers, add my own button to the form.