I have a site set up using a Drupal rule to create a new user account when a new membership is created.

The new account creation triggers a Drupal welcome e-mail to the user, as defined in the Drupal Account Settings, so it's populated using Drupal variables, e.g. 'Dear [user:name]'.

I'm using e-mail addresses for Drupal usernames, but I don't especially want our welcome e-mails to be addressed using only e-mail address. Is there a way to use CiviCRM tokens in Drupal welcome e-mails, so I can address them by name from the contact record?

Even better, most of our individual users inherit their membership from an organisation. If the above is possible, is there also way to use a CiviCRM token to refer to the primary membership? So, for example, I could write something along the lines of, 'An account has been created for you because of your volunteer role with [parent organisation]'?

  • Did you ever come up with a solution for this?
    – Rob Brandt
    Dec 8, 2020 at 19:15
  • Nothing easy to use enough that I've managed it, but I'm sure suggestions here might be worth a go. Dec 11, 2020 at 15:00

4 Answers 4


You might be able to do something with Drupal Entities and Drupal Tokens. You would replace the default welcome emails with one created by rules. CiviCRM Tokens are used exclusively within CiviCRM.



You can use CiviCRM Token module, still in sandbox/development, but it should work. For D8, I've converted this module and it's available at: GitHub.

List of tokens which can support:

CiviCRM civi    Tokens related to CiviCRM.
Contact Dashboard   [civi:contact_dashboard]    CiviCRM contact dashborad of current user.
Contact Email   [civi:contact_email]    CiviCRM contact email of current user.
Contact First Name  [civi:contact_first_name]   CiviCRM contact first name of current user.
Contact ID  [civi:contact_ID]   CiviCRM contact ID of current user.
Contact Last Name   [civi:contact_last_name]    CiviCRM contact last name of current user.
Contact Phone Number    [civi:contact_telephone]    CiviCRM contact telephone number of current user.

If you use Fuzion's CiviToken, you can get the Drupal username and user ID from within CiviCRM.

You might then be able to create a custom token for use with CiviToken to generate a one-time login URL as a token in some way (user_pass_reset_url?) Use the CiviToken examples and put your custom token in custom_php/tokens. (You could also make a custom token to pull the organization name.)

Then you could turn off the Drupal notifications for new accounts and just include these tokens in an email from CiviCRM for new memberships.


You could perhaps sidestep Drupal and

  • use CMS User extension to create the Drupal User. this then has the option of using or not using Drupal 'welcome email', therefore do not use it
  • use CiviRules to send out the welcome email instead (and perhaps that means you have to just include the link to pw reset rather than include a one-time login as drupal would)

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.