This is a support request to understand how to have domain access be aware of which domain a user signed up on and to have the welcome email come from that domain. Is this possible?

At the moment I have two domains, Domain A and Domain B. If User A signs up on Domain B she receives an email which has Domain A's (which is the default domain) site name (using the [site:name] token) in it. Once the account is activated User A receives an email with a one time login link which points to Domain A, which confuses the user as she signed up on Domain B (and isn't aware of Domain A).

Any advice appreciated.

Comments

agentrickard’s picture

That shouldn't happen if you are using Domain Conf to set site names.

tanc’s picture

Thanks for the reply and sorry about the slow response.

I am using Domain Configuration, perhaps you can explain in more detail how to configure it so this situation doesn't occur? The bit I don't understand is how does Domain Access know which domain a user signed up on and therefore which email and tokens to use for all system related emails for that user? Does it store this somewhere along with the user record?

agentrickard’s picture

Oh, it doesn't do that natively. It only knows how to switch from the global request context.

You can pull data for individual users from the {domain_editor} table. Users are auto-assigned to the domain their register from. You can use that domain information to call domain_conf_variable_get().

You likely then need some hook_mail_alter() or similar code to make the substitution.

tanc’s picture

Perfect, that's exactly the information I needed. Feel free to close this issue, if I come up with a solution based on your info I'll post it here for others to make use of.

raj45’s picture

Issue summary: View changes

The Domain token module helped me do this: https://www.drupal.org/project/domain_token

It adds three new tokens:

  • [user:one-time-domain-login-url]
  • [user:site-domain-name]
  • [user:site-domain-login-url]

NB: The Welcome mail has the correct site name out of the box, but the tokens for "Your account has been activated" and "Reset Password" both need the site-domain-name tokens.