Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Get user's name and show on home page

Started by Muut Archive 9 years ago · 2 replies · 1923 views
9 years ago

Hi

I'm trying to get my bearings with Grav, a lot to learn so I'm just playing about at the moment and trying to create a dummy theme.

I've been using lines like {{ page.summary }} to display content but how do I show the user's info like username, full name, title, email, language?

9 years ago

Use {{ grav.user.username }} and the other properties of the User object (you can check which ones are availble by doing {{dump(grav.user)}} with the debug bar.

9 years ago

Hi,

I would start looking at grav login plugin.
check the template file such as templates/partials/login-status.html.twig.
You will see that you can use the following:

TWIG
{{ grav.user.username }}
{{ grav.user.email }}
{{ grav.user.fullname }}

Hope it helps you get on the right track.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1281 9 years ago
Archive · by Muut Archive, 9 years ago
2 888 9 years ago
Archive · by Muut Archive, 9 years ago
2 4018 9 years ago
Archive · by Muut Archive, 9 years ago
1 2894 9 years ago
Archive · by Muut Archive, 9 years ago
3 1077 9 years ago