XenForo Tutorials

Custom Staff Online Titles for Xenforo 2

Submitted by Yondu, , Thread ID: 197751

Yondu
Marry Poppins Y'all
Administrators
Level:
34
Reputation:
190
Posts:
1.48K
Likes:
324
Credits:
3.49K
12-02-2021, 09:02 PM
#1
This is a short and simple guide to achieve custom staff online titles since ordinarily it shows your profile user title instead of a staff title for staff online.

Go to the template widget_members_online.

Find:

Code:
<xf:if is="$user.is_staff">
                            <li class="block-row">
                                <div class="contentRow">
                                    <div class="contentRow-figure">
                                        <xf:avatar user="$user" size="xs" />
                                    </div>
                                    <div class="contentRow-main contentRow-main--close">
                                        <xf:username user="$user" rich="true" />
                                        <div class="contentRow-minor">
                                            <xf:usertitle user="$user" />
                                        </div>
                                    </div>
                                </div>
                            </li>
                        </xf:if>

For Administrator Replace with:

Code:
<xf:if is="{{$xf.visitor.isMemberOf(3)}}">
    <li class="block-row">
    <div class="contentRow">
    <div class="contentRow-figure">
    <xf:avatar user="$user" size="xs" />
    </div>
    <div class="contentRow-main contentRow-main--close">
    <xf:username user="$user" rich="true" />
    <div class="contentRow-minor">
    <div class="usertitle">Administrator</div>
    </div>
    </div>
    </div>
    </li>
    </xf:if>

For other usergroups edit this and replace "3" with the number of your usergroup:

Code:
<xf:if is="{{$xf.visitor.isMemberOf(3)}}">

Also change the title by editing the part where it says "Administrator" in between the 2 div tags.

To find the number of your usergroup click on the usergroup in settings from your admin panel and look in the URL. The number you see in the URL is the number of your usergroup.

To do this for all your staff usergroups or other usergroups simply copy ALL of the code I provided for administrator and paste a second set of it right below the first one.

Now when you go to view staff online the usertitle it should have now be the custom usertitle.

I'd also like to add one note to this. Make sure your primary usergroup is your staff usergroup or this won't work. Initially from Xenforo clean install all primary usergroups are registered and the staff groups are all secondary. This will keep you from getting it to work. You will need to make the staff usergroup your primary usergroup.
[Image: wsUuw16j6oyxLLRnnK.gif]

Users browsing this thread: 1 Guest(s)