Add-on Editing the level of a usergroup

XeStorm

Member
I am currently using XenStaff and i was told i could edit the usergroup level and XenStaff reads off of that level for the group display order. i would like to know how to edit this so i can edit the order they display on the page.

(Note): i do not know exactly what version i am on for Xenforo, but if i need to figure it out i will
 
I am currently using XenStaff and i was told i could edit the usergroup level and XenStaff reads off of that level for the group display order. i would like to know how to edit this so i can edit the order they display on the page.

(Note): i do not know exactly what version i am on for Xenforo, but if i need to figure it out i will

I've got a feeling they are referring to the Display Styling Priority as shown below.

example.webp
 
Try editing the "Display Styling Priority". Since it is an add-on, I can't be sure. It's usually best to ask questions related to an add-on in the addon thread.
 
Unfortunately, I do not use the add-on and my help is at an end (not other guesses). Possibly check in the permissions for some sort of order.
 
So as your saying Owner should show up first, but it shows up like this:
Didn't find XenStaff in the RM, so I can look at it. Is it a paid add-on that you got from the author?

Found it in the archived resources. You may want to check with @Lawrence to get more help.
 
Yep, as you see from my edited post I noted I found it in the archived resources and denoted you may want to check with Lawrence (I tagged his profile) about support.
There is a discussion area for that add-on at that link. You may want to post your request there if you don't hear from him.
 
I don't see a note about changing the display order in that thread. It may require a code edit.
 
I think it may be under the Model/ php files.
Code:
            return $this->_getDb()->fetchAll('
            SELECT user_group_id, title
            FROM xf_user_group
            WHERE user_group_id IN (' . $staffgroups . ')
            ORDER BY user_group_id
            ');
But I don't do PHP at a very high level yet.
 
That's exactly the code that would need changed, @Tracy Perry! I don't know which column is the styling property, but if you change user_group_id to:

"STYLING_PROPERTY DESC" (replacing STYLING_PROPERTY with the proper column name) it will sort by the setting above, with highest coming first. :) Sorry, on mobile so I can't look it up for you.

And do be safe, add in ", STYLING_PROPERTY" after "title".
 
Last edited:
this may sound a little pathetic, buti will paste the code right here and will one of you guys input it? i have a few bad times where i screwed up inputing/replacing



code:
<xen:title>{$xenOptions.staffpageTitle}</xen:title>
<xen:h1>{$xenOptions.staffpageTitle}</xen:h1>

<xen:description>{$xenOptions.staffpageDescription}</xen:description>

<xen:if is="{$xenOptions.staffnoticeActive}">

<xen:if is="{$xenOptions.displaystaffNotice}">
<p class="importantMessage">
{$xenOptions.displaystaffNotice}
</p>
</xen:if>

</xen:if>

<xen:require css="XenStaff_index.css" />
<xen:require css="member_list.css" />

<xen:foreach loop="$staffgroups" value="$staffgroup">

<div id="{$staffgroup.title}" class="section">
<h2 class="staffHeading">{$staffgroup.title}</h2>

<ol class="section memberList">

<xen:foreach loop="$staffgroupsuserids" value="$staffgroupsuserid">

<xen:if is="{$staffgroupsuserid.user_group_id} == {$staffgroup.group_id}">

<xen:foreach loop="$staffuserinfo" value="$user">

<xen:if is="{$staffgroupsuserid.user_id} == {$user.user_id}">

<xen:include template="member_list_item">
<xen:set var="$noOverlay">1</xen:set>
</xen:include>

</xen:if>

</xen:foreach>

</xen:if>

</xen:foreach>

</ol>
</div>

</xen:foreach>

<xen:sidebar>

<xen:if is="{$staffonline}">

<div class="section staffOnline avatarList">
<div class="secondaryContent">
<h3>{$xenOptions.staffonlineHeading}</h3>
<ul>

<xen:foreach loop="$staffonline" value="$user">
<li>
<xen:avatar user="$user" size="s" img="true" />
<a href="{xen:link members, $user}" class="username">{xen:helper richUserName, $user}</a>
<div class="muted">{xen:helper userTitle, $user}</div>
</li>
</xen:foreach>

</ul>
</div>
</div>

</xen:if>

</xen:sidebar>
 
You should use the HTML BBCode next time. ;)

But the code that needs changed is in PHP. Tracy Perry's snippet is what needs changed.
 
You'll need to download the file from your server to edit it in an editor such as Notepad++ or Sublime Text 2.
 
This is Model/StaffGroups.php

PHP:
<?php

    class XenStaff_Model_StaffGroups extends XenForo_Model
    {  
    // returns selected group id's and title
        public function getSelectedUserGroups()
        {
            $userGroups = array();
            foreach ($this->getAllSelectedUserGroups() AS $userGroup)
            {
                  $userGroups[] = array(
                'title' => $userGroup['title'],
                'group_id' => $userGroup['user_group_id']
                );
                        }
            return $userGroups;
        }
        public function getAllSelectedUserGroups()
        {
                        $staffgroups = XenForo_Application::get('options')->staffdisplayGroups;
                        if (empty($staffgroups))
                        {
                                $staffgroups = array(3,4);
                        }
                        $staffgroups = implode(',', $staffgroups);
            return $this->_getDb()->fetchAll('
            SELECT user_group_id, title
            FROM xf_user_group
            WHERE user_group_id IN (' . $staffgroups . ')
            ORDER BY user_group_id
            ');
        }
    }

This is Model/StaffGroupsUserIDs.php
PHP:
<?php

    class XenStaff_Model_StaffGroupsUserIds extends XenForo_Model
    {  
        public function getListofUsersPerStaffGroup()
        {
            $userIds = array();
            foreach ($this->getAllUserIdsPerStaffGroup() AS $userId)
            {
                $userIds[] = array(
                'user_id' => $userId['user_id'],
                'user_group_id' => $userId['user_group_id']
                );
            }
            return $userIds;
        }
        public function getAllUserIdsPerStaffGroup()
        {
                        $staffgroups = XenForo_Application::get('options')->staffdisplayGroups;
                        if (empty($staffgroups))
                        {
                                $staffgroups = array(3,4);
                        }
                        $staffgroups = implode(',', $staffgroups);
            return $this->_getDb()->fetchAll('
            SELECT user_id, user_group_id
            FROM xf_user_group_relation
            WHERE user_group_id IN (' . $staffgroups . ')
            ORDER BY user_group_id
            ');
        }
    }

This is Model/UserGroupOptions.php
PHP:
<?php

    class XenStaff_Model_UserGroupOptions extends XenForo_Model
    {   
    // creates a check box for each user group with an id > 2
        public function getUserGroupOptions($selectedGroupIds)
        {
            $userGroups = array();
            foreach ($this->getAllButCommonUserGroups() AS $userGroup)
            {
                $userGroups[] = array(
                'label' => $userGroup['title'],
                'value' => $userGroup['user_group_id'],
                'selected' => in_array($userGroup['user_group_id'], $selectedGroupIds)
                );
            }
            return $userGroups;
        }
        public function getAllButCommonUserGroups()
        {
            return $this->_getDb()->fetchAll('
            SELECT user_group_id, title
            FROM xf_user_group
            WHERE user_group_id > 2
            ORDER BY user_group_id
            ');
        }
    }
 
Back
Top Bottom