Profile
Grab and display User data.
The {{ user:profile }}
tag (or simply {{ user }}
) will make all the fields in a user available.
If you don’t specify the user with either id
, username
, or email
parameters, the currently logged in user will be shown.
Example
To output the currently logged in user’s details, you can do this:
{{ user }}
The current user's username is {{ username }} and their email is {{ email }}.
{{ /user }}
Or perhaps you’d like to show user profile pages. You could create a wildcard route like this:
routes:
/users/{username}
Then when visiting /users/chuck
, for example, you could display their details like this:
{{ user:profile username="{username}" }}
{{ first_name }} {{ last_name }}
{{ /user:profile }}
Parameters
id
string |
Specify the ID for a user to output their data. Leave blank to target the currently logged in user. |
---|---|
username
string |
Specify the username of a user to output their data. Leave blank to target the currently logged in user. |
email
string |
Specify the email of a user to output their data. Leave blank to target the currently logged in user. |
Variables
user data
mixed |
All user data (front matter) will be available. |
---|---|
no_results
boolean |
If a specified user cannot be found, or if the user is logged out, this will be |
is_[role]
boolean |
A boolean for checking if the user is assigned a given role. eg. |
in_[group]
boolean |
A boolean for checking if the user is in a given group. eg. |