Needs review
Project:
Node clone
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Mar 2014 at 12:31 UTC
Updated:
22 Oct 2020 at 18:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
noopal commentedHi
Im trying to use rules with latest release of this module but having the same problem.
I have set rules to perform an action when a node is clones but the action isnt being performed.
Comment #2
nwom commentedI'm sadly experiencing the same issue.
Comment #3
nwom commentedComment #4
tripodcreative commentedI can confirm that the rules event "After cloning a node" is not firing. I made multiple simple test rules and none have been evaluated on this event. I am using the latest stable version.
Comment #5
tripodcreative commentedAfter going through the code a bit and adding in some watchdog() function calls, as well as calls to undefined functions to see if the site would break (and thus read the code), I'm getting nothing. However, when I add the invoke event on _clone_node_prepare(), it fires. That's not the right function since we want to fire it on submit or save, but we know it works in that context. I'm going to keep digging and see if I can get it to fire under the correct circumstances.
TC
Comment #6
tripodcreative commentedIt seems that the rule fails when the option "Pre-populate the node form fields" is set, as opposed to "Save as a new node then edit."
If you set it to "Save as a new node then edit," the rule fires. This seems to be because clone_node_save is only invoked by functions that are called if the save as new node is set. There's gotta be another function that handles submit if you set to the first option to pre-populate. I don't have time to look into that tonight, but if you select "Save as a new node then edit," you should be good to go w/ rules for the time being.
TC
Comment #7
noopal commentedThere's already an action to run a rule when a node gets edited.
This will work when the clone option is set to "Save as a new node then edit".
Isn't the clone_node_save function kinda redundant in this situation?
Comment #8
pwolanin commentedNot sure about the use case, but something like this?
At least would be more consistent.
Comment #9
thekevinday commentedSwitching to "Save as a new node then edit" is not acceptable for me as I do not want rules to fire that react on new or updated nodes until after any modifications to the clone have been made.
The issue seems to be that there is no presave rule for node_clone.
After looking at the code I found that this can be best implemented as a node_clone_prepare rule.
This happens at the prepare step because a save may not have yet happened.
I have attached a patch that adds the "Preparing a node clone" rule.
You will have to clear the site cache after applying this patch to see the new rule.
Comment #10
pwolanin commentedI'm not sure what the use case is for such a rule. It seems like you'd use the alter hook instead?
Comment #11
myDrupal2014_846824658246 commentedIs it possible that this is still not working after 2 years?
Comment #12
myDrupal2014_846824658246 commentedTrying to apply the patch #9 but getting a error on version = "7.x-1.0";
The command I use is:
$ patch -p0 --dry-run < node_clone-7.x-1.x-add_preparing_clone_rule-2212039-9.patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/clone.module b/clone.module
|index 7b84031..f8e36a8 100644
|--- a/clone.module
|+++ b/clone.module
--------------------------
File to patch:
What to do?
Comment #13
pinueve commentedsee answer that has a cusmon module in
https://drupal.stackexchange.com/questions/212841/do-we-have-another-sol...