Skip to content

User meta tokens

A User meta token reads a value from a user’s meta when the recipe runs, so an action can use profile data that the recipe’s triggers don’t provide. For example:

  • When a user submits a form, send some of their profile information to an external system, such as Zapier or Google Sheets, along with the form data.
  • When a user completes a course, email the user’s manager, whose address is stored in a custom user meta key named manager_email.
  • When a user buys a product in WooCommerce, Easy Digital Downloads, or another store, generate and email a certificate that contains personal information stored in their user meta.

User meta is stored as key/value pairs: you look up a value by its key. If first_name is a key, its value might be Alex. With a User meta token you name the key, and Automator returns the value.

Insert a User meta token

  1. In the action’s Set up step, click the ∗ button at the end of the field that should receive the value.
  2. In the token picker, search for user meta, or open the Global tab, expand Advanced, and click User meta. On a field that expects an email address, such as To, the picker also shows an Email tokens only switch; it is off when the picker opens, and User meta is listed with it off. Managing tokens explains the picker.

The token picker opened from an email's To field on the Global tab, with Email tokens only switched off and the Advanced group expanded to list Calculation, Post meta, User meta, Recipe run # (user), Recipe run # (total), and Automatic login link.

  1. The User meta dialog opens with one field, Meta key. Enter the key whose value you want, such as manager_email. A token reads one key; insert a second token for a second value.
  2. Click Save. Closing the dialog without saving inserts nothing.

The unsaved User meta dialog with manager_email typed in the Meta key field, the line User meta key: manager_email above it, and the Cancel and Save buttons.

The token appears in the field as a chip that reads User meta key: manager_email. When the recipe runs, it is replaced with the value stored under that key for the user, so a chip in an email’s To field sends the email to the user’s manager.

The To field of the Send an email action holding the User meta key: manager_email token chip, above the Reply to field.

Which user the token reads

  • Logged-in users recipes — the user who triggered the recipe.
  • Everyone recipes — the user set in the Run actions as card between the triggers and the actions. Until that card is set up, the token has no user to read; see Recipes for Everyone.
  • Inside a Users loop — the user the Loop block is working on at that moment, so each pass reads that user’s meta.

Besides meta keys, the token can return the user’s account fields, such as user_email, user_registered, or display_name. When a key holds several values, they are returned in one line, separated by commas.

Store your own user data

To add profile fields of your own and manage them from one settings page, use the Custom User Fields Addon; see Managing custom user fields. To write a value to a user meta key from a recipe, use the Set user meta action in the WordPress Core integration, which requires Uncanny Automator Pro.

Related: Managing tokens, Post meta tokens, Calculations (math equations)

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top