The {user} and {created_by} Merge Tag
This GravityKit Academy course, Advanced User Management and CRM Functionality, has real-world examples of using the {user} Merge Tag.
The {created_by}
Merge Tag allows you to display details of the entry creator. It supports all the functionality of the Gravity Forms and uses the same structure as the {user}
Merge Tag documented on the Gravity Forms website.
Difference between {user}
and {created_by}
The {user}
merge tag displays information about the currently logged-in user.
The {created_by}
displays information about the entry creator, if there is one*.
*The user must be logged in when submitting the entry (read more about that here). If the user was not logged in when creating the entry, the {created_by}
Merge Tag will be empty. You can wrap the {created_by}
Merge Tag with a [gvlogic] shortcode to check for its existence.
Usage
All the Merge Tag modifiers below also work with the {user} Merge Tag. Example: {user:user_email}.
{created_by:ID}
- Displays the user ID of the entry creator{created_by:display_name}
- Displays the Display Name of the submitting user.{created_by:first_name}
or{created_by:last_name}
- The first and last name of the entry creator.{created_by:user_email}
- Displays the email of the submitting user.{created_by:user_login}
- Displays the user login of the submitting user. {user:user_login}{created_by:[meta_key]}
- This merge tag can display any user meta (including custom user meta). Replace[meta_key]
with the name of the user meta, example:{created_by:company_name}
.
Use this plugin to create and display custom user meta: Extra User Details.
Example
You can add this code to a Custom Content field to link to the entry creator's User Profile page in the WordPress Dashboard:
[gvlogic if="{created_by}" isnot=""] <a href="/wp-admin/user-edit.php?user_id={created_by:ID}">Link to Profile</a> [/gvlogic]