Limited-Time Donation Special!
Upgrade to Snow for $20 USD and receive a free copy of Oblivion Light ($5 discount).
Upgrade to +Blizzard for $35 USD and receive a free copy of Oblivion Light ($15 discount).

Please visit the thread below for more details.
CLICK HERE

Contact @Davlin with questions or comments.

Jump to content
Shu

XF 2.0 Create a usergroup legend in sidebar

Recommended Posts

Hi,

Today I share a tutorial under xenForo 2.0 : Create a usergroup legend in sidebar !

Create a new template named usergroup_legend :

<div class="block"{{ widget_data($widget) }}>
    <div class="block-container">
        <h3 class="block-minorHeader"><i class="fa fa-user" style="padding-right: 3px;"></i>Usergroup</h3>
            <div class="block-body block-row">
                <dl class="pairs pairs--justified">
                    <div class="username" style="text-align:center;">
            <span class="username--style3">Administrator</span>
            <span class="username--style4">Modérator</span>
            <br><span class="username--style6">Administrator</span>
            <span class="username--style12">Modérator</span>
            <br><span class="username--style18">Administrator</span>
            <span class="username--style10">Modérator</span>
            <br><span class="username--style9">Administrator</span>
            <span class="username--style13">Modérator</span>
            <br><span class="username--style2">Administrator</span>
                    </div>
                </dl>
            </div>
    </div>
</div>

In your template PAGE_CONTAINER find :


<xf:ad position="container_sidebar_below" />

Add this below :

<xf:include template="usergroup_legend" />

Screen :

Screenshot_1.png

Share this post


Link to post
Share on other sites

I attempted to do it this way but for some reason couldn't get it working so I tried it a different way and seems to work perfectly and I guess you can say centralizes it within the XenForo widgets manager.

This is how:

1) Firstly, access your Admin Control Panel. Then from there go to Appearance >> Widgets.

2) In the top right hand corner, click "Add widget"

3) In the dropdown box, select "HTML" and press "Add widget"

4) Going from top to bottom, fill in the fields. The Widget Key and Title are required so just enter the following Widget Key: usergroup_legend Title: Usergroup Legend Keep in mind that anything on this page can be changed at any time so if you do not like the look or the sound of that, you may change it later on.

5) Display in positions: This is where your widget will be placed. You can place it wherever you want really but for the sake of this, I'm placing it in the sidebar underneath the forum statistics sidebar on the home page. So select "Forum list: Sidebar". This should be in the left column 7th from the top or 3rd from the bottom.

6) Set the precedence value in the Forum list: Sidebar to "100"

7) Add the following code to the "Template" code.

<div class="block-body block-row">
 <dl class="pairs pairs--justified">
 <div class="username" style="text-align:center;">
 <span class="username--style3">Management</span>
 <br><span class="username--style5">Administrators</span>
 <br><span class="username--style6">Super Moderators</span>
 <br><span class="username--style4">Moderators</span>
 <br><span class="username--style7">Trial Moderators</span>
 <br><span class="username--style8">VIP</span>
 <br><span class="username--style9">Respected</span>
 <br><span class="username--style2">Registered Users</span>
 <br><span class="username--style10">Banned</span>
 </div>
 </dl>
 </div>

243f439e700b639ff9b8bac532237987.png

  • Like 1

Share this post


Link to post
Share on other sites

Just like you did, by following the tutorial above and instead of editing the PAGE_CONTAINER template you can add <xf:include template="usergroup_legend" /> in a a widget too.

Share this post


Link to post
Share on other sites

What if you don't want to make it inside a widget or sidebar? 

You could use CSS to make it side-by-side compared to being on top of each other;

.whatever {
 display: inline-block;
 margin-right: 15px;
}

 

Share this post


Link to post
Share on other sites
What do you think? Remember the human.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×