I couldn't find this anywhere else, I'm looking up if the currentUser.isInGroup('verified')
and if not, display another link. Works fine when logged in but throws a Template and Runtime error when using the {{logoutUrl}}
or viewing any page when not logged in.
I expected this would work the same as currentUser
by itself, which throws no errors. But obviously there's something I'm missing. Should I be using something like craft.session
in combination with the isInGroup
? Or some other method of detection?
Update
{% if currentUser.isInGroup('verified') is defined %}
Seems to get rid of the errors. So a couple of questions:
- Is this expected behaviour?
- I'm yet to wrap my head around the
|length
is defined
etc methods of checking, and when to use them. I'll have to go over this post a few more times!
- I'm yet to wrap my head around the