Back to vBulletin 4.x Add-ons

Sort View Forum Leaders VB 4.1.11
Mod Version: 1.00, by GrabMyWrist

vB Version: 4.1.11 Rating: (2 votes - 5.00 average) Installs: 13
Released: 15 Mar 2012 Last Update: Never Downloads: 51
Not Supported Code Changes Re-usable Code  

This mod is fairly simple and straightforward.

First, you need to edit the title of the groups you want to display on showgroups.php. To do so you need to edit the group via Usergroups in the Control Panel.

Example:

Site Admin

Site Staff

Moderator

You need to place the following in front of the title of each usergroup you want displayed and sorted.

<! -- x -- >

x is replaced with a number of the order you wish for them to be displayed.

Example:

<! -- 1 -->Site Admin

<! -- 2 -->Site Staff

<! -- 3 -->Moderator

Also, ensure that each group is set to be "Viewable on Show Groups" under Usergroup Options of each group.

Finally, we have to remove the default Moderators list that appears on showgroups.php when you click View Forum Leaders.

To do this you need to edit showgroups.php directly.

Open showgroups.php in your forum root, find the following code and remove it.

Code:
{
	// get moderators **********************************************************
	$moderators = $db->query_read_slave("
		SELECT user.*,
			moderator.forumid,
			usertextfield.buddylist,
			" . ($show['locationfield'] ? 'userfield.field2,' : '') . "
			IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid
			" . ($vbulletin->options['avatarenabled'] ? ",avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight, customavatar.width_thumb AS avwidth_thumb, customavatar.height_thumb AS avheight_thumb, filedata_thumb, NOT ISNULL(customavatar.userid) AS hascustom" : "") . "
		$hook_query_fields
		FROM " . TABLE_PREFIX . "moderator AS moderator
		INNER JOIN " . TABLE_PREFIX . "user AS user USING(userid)
		INNER JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)
		INNER JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid=user.userid)
		" . ($vbulletin->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)" : "") . "
		$hook_query_joins
		WHERE moderator.forumid <> -1
		$hook_query_where
	");
	$modcache = array();
	while ($moderator = $db->fetch_array($moderators))
	{
		if (!isset($modcache["$moderator[username]"]))
		{
			$modcache["$moderator[username]"] = $moderator;
		}
		$modcache["$moderator[username]"]['forums'][] = $moderator['forumid'];
	}
	unset($moderator);
	$db->free_result($moderators);
	if (is_array($modcache))
	{
		$showforums = true;
		uksort($modcache, 'strnatcasecmp'); // alphabetically sort moderator usernames
		foreach ($modcache AS $moderator)
		{
			$premodforums = array();
			foreach ($moderator['forums'] AS $forumid)
			{
				if ($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['active'] AND (($vbulletin->forumcache["$forumid"]['showprivate'] > 1 OR (!$vbulletin->forumcache["$forumid"]['showprivate'] AND $vbulletin->options['showprivateforums'])) OR ($vbulletin->userinfo['forumpermissions']["$forumid"] & $vbulletin->bf_ugp_forumpermissions['canview'])))
				{
					$forumtitle = $vbulletin->forumcache["$forumid"]['title'];
					$premodforums["$forumid"] = $forumtitle;
				}
			}
			if (empty($premodforums))
			{
				continue;
			}
			$clc = 0;
			$modforums = array();
			uasort($premodforums, 'strnatcasecmp'); // alphabetically sort moderator usernames
			foreach($premodforums AS $forumid => $forumtitle)
			{
				$foruminfo = array(
					'forumid' => $forumid,
					'title'   => $forumtitle,
				);
				($hook = vBulletinHook::fetch_hook('showgroups_forum')) ? eval($hook) : false;
				$clc++;
				$foruminfo['comma'] = $vbphrase['comma_space'];
				$modforums[$clc] = $foruminfo;
			}
			// Last element
			if ($clc) 
			{
				$modforums[$clc]['comma'] = '';
			}
			$moderator = process_showgroups_userinfo($moderator);
			if ($vbulletin->options['enablepms'] AND $vbulletin->userinfo['permissions']['pmquota'] AND ($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']
	 				OR ($moderator['receivepm'] AND $moderator['permissions']['pmquota']
	 				AND (!$moderator['receivepmbuddies'] OR can_moderate() OR strpos(" $moderator[buddylist] ", ' ' . $vbulletin->userinfo['userid'] . ' ') !== false))
	 		))
			{
				$show['pmlink'] = true;
			}
			else
			{
				$show['pmlink'] = false;
			}
			if ($moderator['showemail'] AND $vbulletin->options['displayemails'] AND (!$vbulletin->options['secureemail'] OR ($vbulletin->options['secureemail'] AND $vbulletin->options['enableemail'])) AND $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canemailmember'] AND $vbulletin->userinfo['userid'])
			{
				$show['emaillink'] = true;
			}
			else
			{
				$show['emaillink'] = false;
			}
			($hook = vBulletinHook::fetch_hook('showgroups_usergroup')) ? eval($hook) : false;
			$templater = vB_Template::create('showgroups_usergroupbit');
				$templater->register('modforums', $modforums);
				$templater->register('showforums', $showforums);
				$templater->register('user', $moderator); // Needs to be 'user' because we are using the same template as above.
				$templater->register('xhtml_id', ++$xhtmlid2);
			$moderatorbits .= $templater->render();
		}
	}
}
// *******************************************************

Download

No files for download.

Screenshots

Click image for larger version
Name:	Usergroup Edit 1.jpg
Views:	368
Size:	30.7 KB
ID:	137027   Click image for larger version
Name:	Usergroup Edit 2.jpg
Views:	290
Size:	10.5 KB
ID:	137028   Click image for larger version
Name:	View Forum Leaders.jpg
Views:	547
Size:	48.0 KB
ID:	137029  

Similar Mods

Miscellaneous Hacks Cel Forum Leaders - show only primary usergroups on showgroups.php vBulletin 4.x Add-ons

vblts.ru supports vBulletin®, 2022-2024