XF 1.4 Adding an additional TAB to the Notable Members section

#1
I wanted to add an additional TAB to the notable members page under the members link. The code in the template currently looks like this for the TAB links:

Code:
<ul class="tabs">

    <li class="{xen:if '{$type} == "staff"', active}"><a href="{xen:link members, '', 'type=staff'}">{xen:phrase staff_members}</a></li>
    <li class="{xen:if '{$type} == "messages"', active}"><a href="{xen:link members}">{xen:phrase most_messages}</a></li>
    <li class="{xen:if '{$type} == "likes"', active}"><a href="{xen:link members, '', 'type=likes'}">{xen:phrase most_likes}</a></li>
    <li class="{xen:if '{$type} == "points"', active}"><a href="{xen:link members, '', 'type=points'}">
</ul>
I wanted to add a line below the "points" for another user group that would be defined by the user group number. Example:

Code:
{$user.user_group_id} == 34"
This would create another tab and list only those users assigned to that group.
 

j0e

New member
#2
Go to your FTP, open library/XenForo/ControllerPublic/Member.php

Add the bold code
protected function _getNotableMembers($type, $limit)
{
$userModel = $this->_getUserModel();

$notableCriteria = array(
'is_banned' => 0
);

if ($type == 'usergroupnamehere')
{
$notableCriteria['user_group_id'] = array(ENTER GROUP ID HERE);
}

$typeMap = array(
'messages' => 'message_count',
'likes' => 'like_count',
'points' => 'trophy_points',
'usergroupnamehere' => ''
);

if (!isset($typeMap[$type]))
{
return false;
}

return array($userModel->getUsers($notableCriteria, array(
'join' => XenForo_Model_User::FETCH_USER_FULL,
'limit' => $limit,
'order' => $typeMap[$type],
'direction' => 'desc'
)), $typeMap[$type]);
}

Next go to Admin CP -> Appearance -> Templates -> member_notable

Add bolded code.
<xen:title>{xen:phrase notable_members}</xen:title>

<xen:container var="$head.canonical">
<link rel="canonical" href="{xen:link 'canonical:members'}" /></xen:container>

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

<xen:if is="{$userNotFound}">
<div class="importantMessage">{xen:phrase specified_member_cannot_be_found_enter_entire_name}</div>
</xen:if>

<ul class="tabs">
<li class="{xen:if '{$type} == "messages"', active}"><a href="{xen:link members}">{xen:phrase most_messages}</a></li>
<li class="{xen:if '{$type} == "likes"', active}"><a href="{xen:link members, '', 'type=likes'}">{xen:phrase most_likes}</a></li>
<li class="{xen:if '{$type} == "points"', active}"><a href="{xen:link members, '', 'type=points'}">{xen:phrase most_points}</a></li>
<li class="{xen:if '{$type} == "staff"', active}"><a href="{xen:link members, '', 'type=staff'}">{xen:phrase staff_members}</a></li>
<li class="{xen:if '{$type} == "usergroupnamehere"', active}"><a href="{xen:link members, '', 'type=usergroupnamehere'}">TITLE HERE</a></li>
</ul>

<div class="section">
<ol class="memberList">
<xen:foreach loop="$users" value="$user">
<xen:include template="member_list_item">
<xen:set var="$noOverlay">1</xen:set>
<xen:set var="$extraTemplate"><xen:if is="{$bigKey}"><span class="bigNumber">{xen:number {$user.{$bigKey}}}</span></xen:if></xen:set>
</xen:include>
</xen:foreach>
</ol>
</div>
Credit goes to this post https://xenforo.com/community/resources/add-another-notable-member-tab.2403/
 

RichardKYA

Well-known member
#4
Hello,

I wonder if any of you can help me please. I want to do something similar to what you are talking about, but what I have is:

Screen Shot 2015-03-09 at 11.56.30.jpg

You can see I have added a few of the "account_wrapper" tabs to the "member_notable" tabs. They link fine, but I just can't get the "active" class to apply when clicked. Here's my code:

Code:
<ul class="tabs">
    <xen:if is="{$canViewFeaturedThreads} AND {$xenOptions.ctaFtNotableMembersTab}">
    <li class="{xen:if '{$type} == "cta_featured_threads"', active}"><a href="{xen:link members, '', 'type=cta_featured_threads'}">{xen:phrase cta_ft_most_featured_threads}</a></li>
    </xen:if>
    <li class="{xen:if '{$type} == "best_answers"', active}"><a href="{xen:link members, '', 'type=best_answers'}">{xen:phrase most_best_answers}</a></li>
    <li class="{xen:if '{$type} == "likes"', active}"><a href="{xen:link members, '', 'type=likes'}">{xen:phrase most_likes}</a></li>
    <li class="{xen:if '{$type} == "messages"', active}"><a href="{xen:link members}">{xen:phrase most_messages}</a></li>
   
    <li class="{xen:if '{$selectedKey} == "account/ignored"', active}"><a href="{xen:link account/ignored}">{xen:phrase people_you_ignore}</a></li>
    <li class="{xen:if '{$type} == "account/following"', active}"><a href="{xen:link account/following}">{xen:phrase people_you_follow}</a></li>
    <li class="{xen:if '{$type} == "registered"', active}"><a href="{xen:link online, '', 'type=registered'}">{xen:phrase members}</a></li>
</ul>
The top 4 tabs work fine, the bottom 3 I can't get to work, you can see where I've messed about a bit trying a couple of different things, but I give up now lol

Do any of you know what I am meant to be putting there to get them to apply the "active" class?

Thank you very much :)
 
Top