XF 2.0 How do you check permissions in a template?

Jaxel

Well-known member
I'm trying to display a navigation item only when a user has specific permissions... I've tried the following, but getting errors:
Code:
{{ $visitor->hasPermission('EWRrio', 'submitChannel') }}
 
Anyone getting an error calling this in a template? I have extended my user class object and for some reason I can not get this to work.

I keep getting:
Code:
Method hasPermisssion is not callable on the given object
 
Last edited:
It means that the method isn't callable -- is_callable is failing on it. It does appear to be an object, but either the method doesn't exist or it isn't "visible".

At a guess, I'd say you're trying to call it on the wrong variable.
 
Back
Top Bottom