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
|lengthis definedetc 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


currentUseron it's own (withoutis defined) is perfectly fine though, right? – Rob Nov 25 '15 at 00:28{%if currentUser and currentUser.isInGroup('verified') %}– andrew.welch Nov 25 '15 at 00:31