This Plugin Planet tutorial explains how to customize the names of any Custom Fields included in USP Pro’s Email Alerts. This is an advanced tutorial aimed at users who already are familiar with using USP Custom Fields.
By default, names of Custom Fields included in email alerts are displayed like so (using the
%%post_custom%% email shortcode):
usp-custom-1: Value for Custom Field #1 usp-custom-2: Value for Custom Field #2 usp-custom-3: Value for Custom Field #3 . . .
If you customize the
name attribute in your custom-field definitions, then the email alert may look more like this:
usp-custom-phone: Value for Custom Field #1 usp-custom-email: Value for Custom Field #2 usp-custom-media: Value for Custom Field #3 . . .
While this information should make sense to the administrator, it probably won’t make sense to the user. To help with that, it is possible to change the names of the Custom Fields by using “Custom Custom Fields”.
Custom Custom Fields
To customize the name of your Custom Fields, visit the Advanced settings > “Custom Custom Fields”. There you can enter the exact custom field name(s) that you want to include in your form. So for example, for the “Custom Custom Fields” setting, you could do something like this:
Optional Fields: Mobile, Degree, Rank Required Fields: Address, School, Service
After saving your changes, you can use these fields directly. For example, we now can define the following Custom Fields for any USP Form:
name#Mobile name#Degree name#Rank name#Address name#School name#Service
After adding these fields to the form using their respective shortcodes, we’re pretty much done. Whenever the form is submitted, the Email Alerts will look like this:
Mobile: Value for Mobile field Degree: Value for Degree field Rank: Value for Rank field Address: Value for Address field School: Value for School field Service: Value for Service field . . .
Of course, these values will differ depending on the actual submitted information. But you get the idea :)
Specific Custom Fields
The above examples make use of the
%%post_custom%% email shortcode, which includes all Custom Fields that are attached to the submitted post. As of USP Pro version 2.3, you can include specific Custom Fields using the
%%__custom-field-key%% shortcode. For example, to include only the “Mobile” Custom Field in our Email Alerts, we can do this:
Including all six Custom Fields used in the previous example, we could fashion our Email Alerts like so:
Mobile: %%__Mobile%% Degree: %%__Degree%% Rank: %%__Rank%% Address: %%__Address%% School: %%__School%% Service: %%__Service%%
This enables us to craft custom-fit email alerts that display only those fields that should be included. Note the differences between the two email-alert shortcuts:
%%post_custom%%– Displays all Custom Fields, including the Name of Value for each field
%%__custom-field-key%%– Displays only the Value of the specified Custom Field
The best way of understanding how these shortcuts work is to experiment. Try adding both shortcuts to the email-alert message and then check the results of your test posts. Once you see how they work, you’ll be well-equipped to customize your email alerts exactly as desired.