The response to this question indicates that the solution is to save values from the Commerce Profile into the required field(s) of the User Profile using Rules. I can't figure out how to do this!

I created a new Rule, triggered by event "After saving a new commerce customer profile" (though I might well need to integrate this rule into the Commerce Profile creation rule for it to work with required fields. For now, I've just removed the requirement.) Here are the actions that I've picked out as looking like good candidates for doing what I want:

  • Data
    • Add a Variable (Does this mean save a variable with a value, or just instantiate a variable? Where?)
    • Add an Item to a List (What list? Where?)
    • Set a Data Value (How is this different from "Add a Variable"?)
  • Entity (Are User profiles Entities?)
    • Create Entity (Use this to create the new User profile?)
    • Save Entity (Will this save values to the Entity?)

Are any of these going to do what I want? Am I on the wrong track entirely?


1 Answer 1


In order of asking:

  • Data

    • 'Add a Variable' saves data to the {variables} table in the database, to be used with the standard variable_get() method.
    • 'Add an Item to a List' will let you pick an entity and list-type field in the next step to initialise/add another item to (this might include a field with multiple values allowed, say).
    • 'Set a Data Value' will let you set the value for a single, arbitrary field/property (usually as part of an entity). It's different from 'Add a Variable' in that it set the data value on the entity, and doesn't add it to the {variables} table.
  • Entity (profiles provided by the core profile module are not entities, if you're using the Profile2 module, then they are).

    • If you're using Profile2, yes.
    • If you're using Profile2, you'll be able to use it to save the entity after you've used the 'Set a Data Value' to set the value.

Looking through the profile.module and user.rules.inc files I can't see any built in support for the profile module; it stores its data in custom tables and I can't find any glue code that would suggest support's been added for rules (it's worth double checking this though, I could easily be wrong).

If it's not too late on in the build it might be worth having a look at Profile2; as each profile is an entity you'll get rules support built in automatically.

The other thing you could do is write the profile rules functionality yourself (implementing hook_rules_action_info() etc.) but that would be quite a bit more complicated.

Your Answer

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

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