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

Add another "notable member" tab

For example, to list special usergroups

Jake Bunce

XenForo moderator
Staff member
#1
Jake Bunce submitted a new resource:

Add another "notable member" tab - For example, to list special usergroups

library/XenForo/ControllerPublic/Member.php

Add the red code (and specify the secondary group id for your vip members):

Code:
	protected function _getNotableMembers($type, $limit)
	{
		$userModel = $this->_getUserModel();

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

		if ($type == 'vip')
		{
			$notableCriteria['secondary_group_ids'] = array(3);
		}

		$typeMap = array(
			'messages' => 'message_count',...
Read more about this resource...
 

Daniel Hood

Well-known member
#4
Just do the same thing multiple times? Copy the html code twice, copy the php code twice. Unless you meant showing multiple user groups under one tab? Then I think you'd just change
PHP:
$notableCriteria['secondary_group_ids'] = array(3);
to
PHP:
$notableCriteria['secondary_group_ids'] = array(3,4,5);
 

RobParker

Well-known member
#11
I don't quite get the implementation of this. Is the 3 in array(3) the user group assigned as the VIP one?

If I wanted to display a "Donators" tab, can I just change that ID to the donators user group?
 

akia

Well-known member
#15
Is it possible for this to be done as a add on. I don't like modifying core code as I always forget what ive done when it comes to upgrade time.
 

Jake Bunce

XenForo moderator
Staff member
#16
Is it possible for this to be done as a add on. I don't like modifying core code as I always forget what ive done when it comes to upgrade time.
Definitely. It would be fairly easy to make it an addon. I just don't like making and supporting lots of little addons.

Any developer is welcome to copy this code and make a proper addon out of it.
 

Daniel Hood

Well-known member
#18
PHP:
$typeMap = array(
'messages' => 'message_count',
'likes' => 'like_count',
'points' => 'trophy_points',
'vip' => 'message_count'
);
You can use message_count, like_count, trophy_points or try to look /root/library/XenForo/Model/User.php in the conditionals.
 
#20
Why am i getting this?

Code:
Parse error: syntax error, unexpected ''vip'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /home/xx/public_html/library/XenForo/ControllerPublic/Member.php on line 110
@Jake Bunce
 
Last edited: