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

Add-on Editing the level of a usergroup

Discussion in 'Resource and Add-on Discussions' started by XeStorm, Jul 6, 2013.

  1. XeStorm

    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
     
  2. Tracy Perry

    Tracy Perry Well-Known Member

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

    example.png
     
  3. Jeremy

    Jeremy Well-Known Member

    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.
     
    Tracy Perry likes this.
  4. XeStorm

    XeStorm Member

  5. Jeremy

    Jeremy Well-Known Member

    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.
     
  6. Tracy Perry

    Tracy Perry Well-Known Member

    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.
     
  7. XeStorm

    XeStorm Member

    i jsut went to the
    Resources
    and got it, so no i did not get it from the author himself
     
  8. XeStorm

    XeStorm Member

  9. XeStorm

    XeStorm Member

    it is not a paid addon also, so i did not get it from the author himself
     
  10. Tracy Perry

    Tracy Perry Well-Known Member

    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.
     
  11. Jeremy

    Jeremy Well-Known Member

    I don't see a note about changing the display order in that thread. It may require a code edit.
     
  12. XeStorm

    XeStorm Member

    one sad thing is, the only code language i know is HTML, and not a whole lot of that. so i might have to look for someone to do that if needed.
     
  13. Tracy Perry

    Tracy Perry Well-Known Member

    It looks like someone in 02/2012 asked about it here, or something similar and there has been no response.
     
    Jeremy likes this.
  14. Tracy Perry

    Tracy Perry Well-Known Member

    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.
     
    Jeremy likes this.
  15. Jeremy

    Jeremy Well-Known Member

    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: Jul 6, 2013
  16. XeStorm

    XeStorm Member

    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>
     
  17. Jeremy

    Jeremy Well-Known Member

    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.
     
  18. XeStorm

    XeStorm Member

    now here is my problem. do i need something special to get to the PHP?
     
  19. Jeremy

    Jeremy Well-Known Member

    You'll need to download the file from your server to edit it in an editor such as Notepad++ or Sublime Text 2.
     
  20. Tracy Perry

    Tracy Perry Well-Known Member

    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
                '
    );
            }
        }
     

Share This Page