Tutorial 2x Custom Staff Online Titles for Xenforo 2 - Tùy chỉnh tiêu đề Staff Online cho XenForo 2

PVS

Super Moderator
Thành viên BQT
Custom Staff Online Titles for Xenforo 2 - Tùy chỉnh tiêu đề Staff Online cho XenForo 2

Đây là hướng dẫn ngắn và đơn giản để tùy chỉnh tiêu đề staff online vì thông thường nó hiển thị tiêu đề profile user thay vì tiêu đề staff cho staff online.

Đi đến template widget_members_online.

Tìm:
Mã:
        <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>

Cho Administrator, Super Moderator, và Moderator thay bằng:
Mã:
<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:if is="{{ $user.isMemberOf(x) }}">
<div class="usertitle">Administrator</div>
<xf:elseif is="{{ $user.isMemberOf(y) }}" />
<div class="usertitle">Super moderator</div>
<xf:elseif is="{{ $user.isMemberOf(z) }}" />
<div class="usertitle">Moderator</div>
<xf:else />
<xf:usertitle user="$user" />
</xf:if>
</div>
</div>
</div>
</li>
</xf:if>

Bạn sẽ cần phải thay thế x, y, hoặc z của đoạn code trên với ID usergroup của bạn:

Để tìm ID usergroup, nhấp chuột vào usergroup trong ACP của bạn và xem trong URL. Số bạn thấy trong URL là ID usergroup của bạn.

Sau đó, bạn chỉ cần thay đổi tiêu đề người dùng giữa thẻ div ứng với tiêu đề thích hợp để nó xuất hiện trên staff online.

Để làm được điều này bạn cần có tối thiểu 3 usergroup. Nếu có nhiều hơn, bạn chỉ cần thêm các câu lệnh xenforo elseif khác tương tự như ở trên.

Bây giờ khi bạn xem staff online thì các usertitle cần phải có bây giờ là usertitle đã tùy chỉnh.

Chúc các bạn thành công.


Nguồn: xenforo.com​
 
Back
Top