I created rules to auto-generate the node title and path after the node was created (because Automatic Nodetitles wasn't doing this properly - the fix was suggested here and worked a treat). I also have User Points installed which gives a user 10 points for creating a new node and 5 for editing a node. Now when creating nodes I am being given 10 points, 5 points and another 5 points, all at the same time. I am not editing the nodes after creating them. If I turn off the rule which generates the node title after saving new content the problem goes away and I get just 10 points for creating the node, suggesting that the rule is generating two node revisions after a save. (Turning off the rules for generating the path after saving new content and updating node titles after editing doesn't make any difference.)
Comments
Comment #1
mitchell commentedCould you upload exports of your rules and the debug logs too?
Comment #2
thoughtcat commentedI've just added a new node (content type "track") and got the extra "userpoints". I've since added further rules to send me an email when new content has been added or edited, and I've got one email to say "new content created" and another two both saying the node has been updated.
Not sure where I can find the debug logs you ask for? /admin/reports/dblog though only shows "track: added", not "track: updated", if that helps?
I edited the track manually a few minutes later and got 2 x 5 userpoints and two "help" messages saying the track had been edited and again two more "update" emails. dblog has recorded one "update" of the track. So that would suggest the "update" rule fires twice of its own accord, but doesn't explain why creating the node fires the update rule at all.
Here's the export of the rule that fires "after saving new content":
Comment #3
mitchell commentedTurn on Rule's debug log in the configuration options. See https://drupal.org/node/1538864
Comment #4
thoughtcat commentedOK thanks, done that. I added another node and the debug log shows (in order) the three emails firing off, then "node added", then the Rules debug info which is:
Comment #5
mitchell commentedHave you reviewed this output? What are your thoughts?
Please upload long text in a separate file instead of using blockquote.
Comment #6
thoughtcat commentedSorry, will remember that next time.
I have reviewed it now and can see the "fix title on edit" and "fix perf title on edit" rules are also firing on "after updating existing content", which would account for the extra revisions. I see at 43.385 ms "Saved node of type node", so if that means that the content now "exists" I guess that might be why "after updating existing content" rules are running afterwards, but I still can't see why they should be triggered?
I've tried changing the weights of the rules to put the "after updating existing content" rules before the "after new content is saved" ones to see if this would stop the former running after the latter, but it hasn't worked.
Do I need to add another condition to the two unnecessary "after updating existing content" rules to stop them firing?
Comment #7
acbramley commentedI'm getting this problem too, I have a similar Rule with emails being sent using the After saving new content event, and 3 conditions being ANDed together. When I have the rule enabled and save a piece of content, 2 revisions are created, therefore the rule is run twice and duplicate emails are sent. Disabling the rule stops the double revisions being generated.
Comment #8
nicodv commentedSame here, I just used the event "After saving new content" and reduced my rule to almost nothing: "Show a message on the site" saying 'hola', but the rule is not being fired. (no conditions... nothing)
Am I missing something?
Comment #9
nicodv commentedhttp://drupal.org/node/1068168
Comment #10
cwsmith1701 commentedI have two rules in version 2.2 that redirect upon saving a specific node to different parts of my site. But the redirect drops you back at a blank add node page for the types, and results in 24 copies of the node. I'm not sure why that is.
Comment #11
tr commented#1704290: Improve recursion prevent to cover saves of other rules as well