Cannot get data out of grav.user

I have been looking for documentation on variables that I can use in twig for my template, and there doesn’t seem to be much available. I figured, based on how the login plugin displays

welcome {{ grav.user.username }}

I would be able to use that variable, but I can’t seem to get any output from it. I am logged in as a super user, and am really trying to get a true or false if the current user has access to the admin panel, that way I can create a link in the header to take me there without having to type /admin in the address bar everytime. However, I can’t even get it to output my username. Am I using this wrong?

I tried in my theme to insert

<pre> {{ dump(grav.user) }} </pre>

and that got me nowhere. Any advice?



I’m assuming i’m already talking to you on our chat. Let me know if that is not the case :slight_smile:

Yes, that is correct. Thanks for the help. If anyone else runs into this, the first thing ot note is that Grav pipes the dump command to the debug bar, so you’ll have to enable it, as noted here:

That should get you going on debugging variables in grav.