Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Rules and referenced user tokens

Rules are great for workflows. We have about 30 rules in place on our intranet to help almost every part of our daily workflow, and as with most offices communication between we mere mortals and our fearless leaders is critical. With the help of realname and realname user rereference we create a convenient user interface for data entry,

Realname User Reference Widget

After that we work with Rules and Tokens to create a more automated workflow.  For the Video types there’s a brief ~3 minute video.

The important thing to remember when working with user references in rules is that you must load the user reference BEFORE those that user and the associated tokens become available.  Give your user reference a handy name to create your unique tokens and you’re ok.  Once you have loaded the referenced user into your rule, the tokens are available to use – any information stored in the referenced user’s profile is there too. Also used in this tutorial though not mentioned explicitly is html mail for sending prettier emails through rules.

This is how our rule looked at the end

Debugging: If you find yourself in trouble remember that in the settings page you may turn on the rules debugger (which, depending on the number of rules may churn out a rather lengthy list… ). In the settings there’s also an option to turn off token warnings.  This may tell you whether or not you’ve done your job with the use of tokens.

Debugging Rules - tokens have options too

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web