• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Implemented Method to check permissions in a template


Well-known member
Since we don't "need" to use template hooks anymore, it would be really cool if we could check the $visitor permissions in the template too.

Because of the missing template hook code, i would need to use the proxy class system to extend the controller to attach only
$parentReturn->params['canViewFoo'] = XenForo_Visitor::getInstance()->hasPermission('my_addon','view');
Would be nice to avoid the overhead and be able to check the permission direct in the template

Chris D

XenForo developer
Staff member
You can already do this. The visitor object contains all of the unserialized permissions:

<xen:if is="{$visitor.permissions.group.permission}">
Where group is the permissions group, eg forum and permission is the actual permission eg view.