Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Get user's name and show on home page

Started by Muut Archive 9 years ago · 2 replies · 2233 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 Muut Archive, 10 years ago
1 672 1 week ago
Archive · by Deleted User, 9 years ago
0 3042 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5336 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago