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

User Group Permissions: Administrative

AndyB

Well-known member
#1
Hello,

I would like to change the sorting of this template.

pic001.jpg

The reason is that XenForo sets the Interface Group/Display Order between 1 and 205. So I have set my Group/Display Order add-ons all set to 300. This way they all fall after the default XenForo Permission Groups.

What I would like to do is add a secondary sort to the Model.

Could someone please point me to the correct Model that is used get the values which this template uses.

Thank you.
 

Chris D

XenForo developer
Staff member
#2
You might have to elaborate somewhat. For what purpose do you need a secondary sorting criteria?

Is the secondary criteria sorting an add-on in itself or part of some other add on you are releasing?
 

AndyB

Well-known member
#4
You might have to elaborate somewhat. For what purpose do you need a secondary sorting criteria?

Is the secondary criteria sorting an add-on in itself or part of some other add on you are releasing?
Hi Chris,

When I want to change a User Group Permission for one of my add-ons, this is what I see:

(scrolled all way down to show there is no secondary sorting)

pic001.jpg

Amazon should show before the other add-ons.
 

AndyB

Well-known member
#5
Got it.

library/XenForo/Model/Permission.php

Line 399 original code
PHP:
    /**
     * Gets all permission interface groups in order.
     *
     * @return array Format: [interface group id] => interface group info
     */
    public function getAllPermissionInterfaceGroups()
    {
        return $this->fetchAllKeyed('
            SELECT *
            FROM xf_permission_interface_group
            ORDER BY display_order
        ', 'interface_group_id');
    }
Line 399 modified code
PHP:
    /**
     * Gets all permission interface groups in order.
     *
     * @return array Format: [interface group id] => interface group info
     */
    public function getAllPermissionInterfaceGroups()
    {
        return $this->fetchAllKeyed('
            SELECT *
            FROM xf_permission_interface_group
            ORDER BY display_order, addon_id
        ', 'interface_group_id');
    }
 

Floyd R Turbo

Well-known member
#9
@AndyB in ACP, Debug mode on > Dev tab > Permissions Definitions you can edit each permissions interface group and change the display order.

my question is, does this get overridden on an upgrade? Maybe a question for @Chris D.

My purpose is just wanting to sort the permissions to my liking. I'm assuming that "Display Order" is just that, and not a priority order of any kind. I know that sounds kind stupid but better to ask...just dabbling with debug mode
 

Chris D

XenForo developer
Staff member
#10
It is indeed harmless to change the display order, but pretty pointless as they will get reset.

If the permissions belong to an add-on, the display orders will be reset on upgrade (to the values defined by the add-on developer. If the permissions belong to XenForo, then the same happens when XF is upgraded (to the values defined by us).