Use Gravity Forms merge tags for email notifications

Gravity Forms - for your WordPress form needs

I have written a few times about how I’ve used Gravity Forms to streamline my productivity, by automatically creating tasks in my To Do app for example.

Another way that I’ve been able to simplify my forms and use merge tags to avoid requesting redundant information is forms that have been built specifically for logged-in users.

For example, at The WP Butler I have several member-only forms: things like requests to restore from a backup, or a development request.

I have been able to make these forms as simple as possible for my users by not asking for information from them that WordPress already knows. For example, WordPress knows the name and email address of every one of my members, so there’s no point in me asking for it. Instead, I can use Gravity Forms merge tags to automatically insert it where needed.

In my case, I want to use them in my email notifications, so that when a user submits a request, I get an email that comes from their name and email address, so that if need be, I can reply directly to that email and have it sent to them, without it coming from a common address and forwarding that on to the person in question.

How to use merge tags

The merge tags in Gravity Forms can be used on the WordPress standard user meta fields (like name, login, display name etc.), but they can also be used on any custom profile fields. The syntax is the same in either case. These merge tags take the form of {user:[meta_key]} where [meta_key] is the meta key for that profile field.

So for example, the meta key for a user’s email address is user_email (this is a WordPress standard one – see them all here), so to automatically insert that data somewhere in your form or notification, you can use the following merge tag instead:

{user:user_email}

merge-tag-notifications

And if you have a custom profile field, then the same applies. I have a custom field with the meta key of ‘twpb_domains’ to note the domain linked to one’s account, and to pull that in to my notification, I just need to use {user:twpb_domains}

custom-field-merge-tags

You may also notice that I used another merge tag there that I haven’t mentioned yet. This is the {form_title} tag, which is a Gravity Forms specific one. There are several that you can use to automatically insert information about a form entry (like IP address, the entry date etc.) or even more powerful stuff like post meta. I suggest taking a look at the Gravity Forms docs to see how else you can use merge tags to make your life simpler (as well as your users’).

Get Gravity Forms

Leave a Reply