3

Use case: On my site, when a user registers, four nodes of four different content types are automatically created using rules. I would like references to these nodes to be stored using node/entity reference* fields in the user profile. I want to use rules to assign each node to the respective field in the user profile automatically. Is there a way to configure a rule to do this?

I tried using the rules "Set a data value" to set the user profile field to the created node but that didn't work-- it doesn't give an error, but after the rule is triggered the reference is still unset.

  • I wrote "entity/node" reference because I am happy to use either the entity reference or the references module, so long as I can get a solution.
  • I would generally recommend you stay aware from the references module. It's a port from a great D6 module that today is inferior to the newer D7 entityreferences in almost every way. – Letharion Mar 24 '12 at 21:41
  • duplicateted. this is already answered [here][1] [1]: drupal.stackexchange.com/questions/88437/… – pinueve Sep 8 '15 at 14:36
  • @pinueve It's not a duplicate if this question was asked a year earlier... – Patrick Kenny Sep 14 '15 at 6:46
  • @Patrick, I didn't meant to be rude, I'm just pointing a solution to your question, and to all users, and link both questions. – pinueve Sep 15 '15 at 17:03
0
+50

I suggest you take a look at the Relation module. We have added rules support specifically for this type of use case, so that should do it for you.

If what you are trying to do is somehow beyond the capabilities of the current rules integration, you can open a feature request, and we will attempt to work it out.

  • Thank you! I had originally avoided the Relation module because it seemed overly complex; however, after about five hours of work, I now have a much more robust solution that also allows me to much more easily string views together. – Patrick Kenny Mar 24 '12 at 15:50
2

For what it's worth, you can do this with entity references & rules alone. Nodeone.se has a video covering exactly this scenario. Relation has great potential, and is a much more intelligent way to go about relationships, but it can be tough to use (especially for non-devs) because it lacks a strong way to make new references.

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.