I have a large database of properties and property owners that I have uploaded separately.

I import the nodes through feeds.

I import the users separately also through feeds.

The problem that I have is that the feed node author is all set to the same, in this case anonymous. I have uploaded an extra field to the node called reference. This reference is the same as a reference on the user upload.

Therefore I have to change in bulk the author of the anonymous nodes to the corresponding users by comparing the references.

I am currently using Views Bulk Operations and doing this manually.

I am not a strong coder and not comfortable with writing custom modules. I have been unable to configure rules to do this also. Is there any suggestion for a way to automate this process?

Thanks!

Comments

spovlot’s picture

What type of field is "reference"? Is it a Reference field or text?

To automate with VBO, you need to create a Rules component. You can find a tutorial on this at http://nodeone.se/en/using-rules-components-with-vbo .

ejb503’s picture

Thanks for the adrice, i did try and fail with rules but ill have another bash! They are text fieles...

spovlot’s picture

Here is an example Rule component that will assign a user to a content node. You can import this under the Components tab using the "Import component" link. You will need to modify this component to remove the user_name parameter and get the user name from your reference field. You will need to add a condition to the rule to validate that the node is your specific content type. Then you will be able to fetch the user entity by your reference field.

{ "rules_assign_user" : {
    "LABEL" : "Assign User",
    "PLUGIN" : "rule",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : {
      "node" : { "label" : "Content", "type" : "node" },
      "user_name" : { "label" : "User Name", "type" : "text" }
    },
    "DO" : [
      { "entity_query" : {
          "USING" : {
            "type" : "user",
            "property" : "name",
            "value" : [ "user-name" ],
            "limit" : "1"
          },
          "PROVIDE" : { "entity_fetched" : { "user_fetched" : "Fetched User" } }
        }
      },
      { "data_set" : { "data" : [ "node:author" ], "value" : [ "user-fetched:0" ] } }
    ]
  }
}
ejb503’s picture

I am managing this importation on Monday, I will let you know how I get on, many thanks!