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"), thus taking the Rules Block/Unblock User module out of the equation, 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" } }
        }
      }
    ]
  }
}
CommentFileSizeAuthor
#3 Screen Shot 2016-09-30 at 20.34.22.png250.5 KBopdavies
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hockey2112 created an issue. See original summary.

hockey2112’s picture

Issue summary: View changes
opdavies’s picture

Status: Active » Closed (cannot reproduce)
FileSize
250.5 KB

I've created a new Drupal 7 site, installed this module and it's dependencies, and imported your rule.

I used Devel Generate to create some users and added the photo content type.

I tested blocking and unblocking two separate users, and only one photo was created for each user.

I'm not sure why in that case you are getting two nodes created.