0

I'll try to explain what I need to achieve:

  1. User submits profile data during the registration proces (using Profile2 module).
  2. Rules trigger event "After saving a new user account" that creates a new node, and then copies Profile 2 data fields to a new node.

Any ideas how can I get this working? Guess I need to use Action "Create a new entity" but not sure how can I pull data from Profile 2 and then save it to a new node?

Thanks a bunch!

1 Answer 1

0

Why do you want this through Rules?..according to me a simple submit handler, grabbing the data on submit and creating a node programatically will be a much better approach. I can provide you direction on this if you let me know you want to go with this approach.

Update:

Here is my suggested workflow:

  1. Use hook_user_save() to grab the submitted profile field values. All the profiles2 field you add, will be available in the user object.

  2. Next in the content type you want to save the values, create proper fields so that you can map and store data.

  3. you can look up in google to see how you can progmatically create a node. So you can grab the required values, and map them to appropriate fields you added to the node and then save the node.

Just a thought, I am really curious why are you trying to do this?

3
  • Thank you for the reply Neo! Honestly I had no idea what is the best and most efficient approach here since I'm new to Drupal. That said, I'm open for any idea that could work. So yes, please go ahead and provide me with some instruction. Thanks again! :)
    – Antonio
    Oct 7, 2013 at 18:46
  • I edited the answer. Have a look.
    – Neo
    Oct 7, 2013 at 20:09
  • Thank you Neo! I've found a post that explains a similar scenario. You can take a look it here: drupal.stackexchange.com/questions/10496/… I basically have the same scenario except I would like to prepopulate node on registration, rather than on node creation. Anyway I think that advised aproach is great! Thank you!
    – Antonio
    Oct 7, 2013 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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