vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Color coded usergroups (https://vborg.vbsupport.ru/showthread.php?t=277533)

Clydesdale 01-25-2012 02:33 PM

Color coded usergroups
 
Good morning to you all.

I am wanting to know how i would add a color code section to the Currently Active Users: 2 (1 members and 1 guests) section.

Something similar to either

• Administrators • Super Moderators • Moderators • VIP Member • Registered Users

or

Administrators | Moderators | Punished Member | Super Moderators | VIP Member

But with each group a different color.

I am running 3.8.7

Thanks in advance for the help

kh99 01-25-2012 03:50 PM

$vbulletin->usergroupcache[] has the information for each group, so in a plugin you could do something like:

PHP Code:

foreach ($vbulletin->usergroupcache AS $usergroup)
{
   
$usergroups[] = $usergroup['opentag'] . $usergroup['title'] . $usergroup['closetag'];
}
$usergroup_legend implode(' | '$usergroups); 


or if you want to control the groups or order of the included groups, you could use this instead:

PHP Code:

foreach (array(654328) AS $groupid)
{
   
$usergroup &= $vbulletin->usergroupcache[$groupid];
   
$usergroups[] = $usergroup['opentag'] . $usergroup['title'] . $usergroup['closetag'];
}
$usergroup_legend implode(' | '$usergroups); 


(BTW, I haven't tried these so there could be typos...).

Clydesdale 01-25-2012 04:36 PM

Quote:

Originally Posted by kh99 (Post 2292253)
$vbulletin->usergroupcache[] has the information for each group, so in a plugin you could do something like:

PHP Code:

foreach ($vbulletin->usergroupcache AS $usergroup)
{
   
$usergroups[] = $usergroup['opentag'] . $usergroup['title'] . $usergroup['closetag'];
}
$usergroup_legend implode(' | '$usergroups); 


or if you want to control the groups or order of the included groups, you could use this instead:

PHP Code:

foreach (array(654328) AS $groupid)
{
   
$usergroup &= $vbulletin->usergroupcache[$groupid];
   
$usergroups[] = $usergroup['opentag'] . $usergroup['title'] . $usergroup['closetag'];
}
$usergroup_legend implode(' | '$usergroups); 


(BTW, I haven't tried these so there could be typos...).

:confused: At the risk of sounding like an idiot....

I am a extreme novice at all of this. can you break this down "barney style?"

kh99 01-25-2012 05:27 PM

Well, a couple of things: the code I posted would only build the legend part, and it only works if you've already entered html markup in the usergroup manager to color code usernames by group. But assuming you've done that, create a new plugin using hook location forumhome_complete and this code:

PHP Code:

foreach ($vbulletin->usergroupcache AS $usergroup

   
$usergroups[] = $usergroup['opentag'] . $usergroup['title'] . $usergroup['closetag']; 

$usergroup_legend implode(' | '$usergroups); 


Then in your FORUMHOME template, put $usergroup_legend where you want it to appear. When I tried it it came out fairly large, so you might want to put a <span>..</span> around it or something to control the font size.

HMBeaty 01-25-2012 07:36 PM

Quote:

Originally Posted by Boofo (Post 2292348)
Or you could look in the usergroups settings at the top for the html markup. ;)

I think the OP is going after displaying a "legend" for the usergroups though ;)

Which, if you did a search for legend there are already several mods for this :p

kh99 01-25-2012 09:14 PM

Quote:

Originally Posted by HMBeaty (Post 2292352)
Which, if you did a search for legend there are already several mods for this :p

lol...Thanks Brooks - and sorry Clydesdale, sometimes I forget to check for an existing mod. :o

Clydesdale 01-25-2012 10:49 PM

Quote:

Originally Posted by kh99 (Post 2292388)
lol...Thanks Brooks - and sorry Clydesdale, sometimes I forget to check for an existing mod. :o

That makes two of us..... Sucks being the uber-novice!


All times are GMT. The time now is 09:14 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01124 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete