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

Methods of Checking User Permissions (Not Visitor)


Well-known member
What are the possible methods of checking for the currently logged in user's permissions? I'm trying to do a quick permission check in XenForo_Template_Helper_Core and struggling.


Well-known member
There are two ways...

XenForo_Permission::hasPermission($viewingUser['permissions'], 'PermissionGroup', 'PermissionId')
$viewingUser = null;

$perms['custom'] = (XenForo_Permission::hasPermission($viewingUser['permissions'], 'EWRporta', 'canCustom') ? true : false);
Or... you can do... (its not the "correct" way)
$visitor = XenForo_Visitor::getInstance();
$perms['custom'] = ($visitor['permissions']['EWRporta']['canCustom'] ? true : false);
The second method can even be used in templates!
(this may not be the correct way, but I have not run into any issues yet)
<xen:if is="$visitor.permissions.EWRporta.canCustom">


Well-known member
I managed to do this in the end by creating a user model and joining the permissions to the getUserById() function.