3

Ok so here's the use case:

Our site also includes phpBB forums, which of course display the user name in posts... most people don't like their email address being displayed, for obvious reasons.

Orders placed by anonymous users automatically generates an account with the username the same as the email address. I want to keep the auto account creation, but have the user enter a UserID when they enter their billing info.

So i've created a field on the billing profile (field_account_name is the machine name). How do i reference that field in the entity creation rule? I looked at this topic: http://www.drupalcommerce.org/questions/5370/how-do-i-base-new-account-u... but that doesn't show me how to reference a field i've created, only ones that already exist in the commerce-order entity.

This might be a stupid question, but i'm still relatively new to drupal... any help would be HUGELY appreciated.

I also posted this on the Commerce site, but it doesn't look like that gets tons of answers.

  • did you check out the rules section where a completes an order and creates an account on the site? from there maybe there is an option to select how to create a user. – Patoshi パトシ Jan 4 '14 at 5:05
  • Yes, I went through that and I can use things that already belong to the customer billing entity, but not custom fields that i add to that entity. I need to be able to add a custom field and then modify the rule to use that field to create the account. I can add the fields, but i don't seem to be able to access them. – jshook Jan 6 '14 at 18:39
2

On the create user Rule you need to bring field_account_name into scope by running condition "Entity has field."

First run EHF on Commerce Order to bring the billing profile reference into scope. Then you can EHF your account name field.

You then will have the ability to have access to that field's token and use it as the new account's username.

Note: this is more a Rules usage technicality, which Commerce uses heavily.

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.