XF 1.5 How to get permission based on priority?

grisha2217

Active member
Hello, i'm beginner in xenforo.
I made a row in user rights, let's call it time limit

There is two groups: admins and premium.
For example, i'm visitor of forum and have general group - registered and two secondary groups: admins and premium.
Admins has 500 priority, premium has 400 premium.

When i check "time limit" via hasPermission(), i got value by premium group, why?
 
The priority you refer to relates to display styling systems. Permissions have their own system; integers always use the higher value.
 
The priority you refer to relates to display styling systems. Permissions have their own system; integers always use the higher value.
Thanks you for explanation, how i can solve my problem, if i want to choose user group permission with smaller value?
 
I think, i need a method to parse permissions by usergroup id, i will get usergroup id by display_style_group_id and pass it to needed function
 
The short of it is that you can't. Permissions generally need to be written in such a way that, for boolean permissions, a "yes" value is more permissive and, for integer permissions, a higher value is more permissive.

Anything else would really need an entirely custom approach.
 
The short of it is that you can't. Permissions generally need to be written in such a way that, for boolean permissions, a "yes" value is more permissive and, for integer permissions, a higher value is more permissive.

Anything else would really need an entirely custom approach.

I have found needed method: getAllGlobalPermissionEntriesForUserCollectionGrouped in XenForo_Model_Permission.
I pass display_style_group_id and 0 in this function and get needed permissions, in most cases it works, i feel good
 
Back
Top Bottom