Resource icon

Add another "notable member" tab

Jake Bunce

Well-known member
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):

Rich (BB 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...
 
Ah man we gotta edit the files on the server? Can you make an addon version of this?
 
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);
 
Well then yes, you would just copy the code multiple times. I'll let Jake give a more detailed example as it's his tutorial.
 
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?
 
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.
 
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.
 
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.
 
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:
Back
Top Bottom