1

I am using a Rule, along with the Rules Block/Unblock User module, to create a specific type of node when a user is unblocked (a simple custom note called "Photo" that contains an image field and a token field for the title). The resulting node is authored by the newly unblocked user. The Rule is currently creating the node, but it is also creating a duplicate of that new node (with the same values). It is important that only one node be created, because I have imposed a limit on the number of nodes each user can create (5 total, including the node created by the Rule).

As a test, I removed the "user_was_unblocked" event and replaced it with "user_insert" ("After saving a new user account"), and that resulted in only one node (no duplicate), but it is important for my process that the node creation occur on unblock instead of creation.

What would cause these duplicates to occur?

Here is an export of my Rule:

{ "rules_create_default_public_photo_node_test" : {
    "LABEL" : "Create Default Public Photo Node TEST",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "user" ],
    "REQUIRES" : [ "rules", "rules_block_user" ],
    "ON" : { "user_was_unblocked" : [] },
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "node",
            "param_type" : "photo",
            "param_title" : "Default Photo for [account:name]",
            "param_author" : [ "account" ]
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      }
    ]
  }
}
1

According to the current status of issue # 2783453 (which IMO should be a support request), this looks like something else is happening in your site.

Something that will help you find the answer to your question, is to have a look at Rules debugging ... Within the Rules settings, experiment a bit with the debugging facilities that come with Rules. At least have a look at the "Rules Evaluation Log" (to check that the Rules logic being executed, actually matches what you expect that logic to be).

For way more details about Rules debugging, refer to the answer to "How can I display the value of a variable inside a condition?".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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