Overview
The {{ user:profile }}
tag has access to all of a user's basic data. Passwords and hashes are not available through this tag.
This will default to the currently logged in user if none are specified.
Shorthand
You can use {{ user }}
and drop the :profile
bit off if you prefer.
Examples
To output the currently logged in user's details, you can do this:
{{ user }} The current user's name is {{ name }}.{{ /user }}
Or perhaps you'd like to show user profile pages. Assuming your users have a username
field, you could create a wildcard route like this:
Route::statamic('users/{username}', 'users.show');
Then when visiting /users/chuck
, for example, you could display Chuck's details like this:
{{ user:profile field="username" :value="segment_2" }} {{ first_name }} {{ last_name }}{{ /user:profile }}
Or to find a user by email:
{{ user:profile :email="email" }} {{ first_name }} {{ last_name }}{{ /user:profile }}
Parameters
id
Fetch user by ID.
Fetch user by email.
field
Fetch user by a specific field value. Used with value
below.
value
Value of above field
to fetch user by.
Variables
Variable | Type | Description |
---|---|---|
user data |
mixed |
All user data (except password) is available. |
no_results |
boolean |
|
is_[role] |
boolean |
|
in_[group] |
boolean |
|