Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-25-2012, 02:33 PM
Clydesdale's Avatar
Clydesdale Clydesdale is offline
 
Join Date: May 2011
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 01-25-2012, 03:50 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$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...).
Reply With Quote
  #3  
Old 01-25-2012, 04:36 PM
Clydesdale's Avatar
Clydesdale Clydesdale is offline
 
Join Date: May 2011
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
$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...).
At the risk of sounding like an idiot....

I am a extreme novice at all of this. can you break this down "barney style?"
Reply With Quote
  #4  
Old 01-25-2012, 05:27 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 01-25-2012, 07:36 PM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
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
Reply With Quote
  #6  
Old 01-25-2012, 09:14 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by HMBeaty View Post
Which, if you did a search for legend there are already several mods for this
lol...Thanks Brooks - and sorry Clydesdale, sometimes I forget to check for an existing mod.
Reply With Quote
Благодарность от:
HMBeaty
  #7  
Old 01-25-2012, 10:49 PM
Clydesdale's Avatar
Clydesdale Clydesdale is offline
 
Join Date: May 2011
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
lol...Thanks Brooks - and sorry Clydesdale, sometimes I forget to check for an existing mod.
That makes two of us..... Sucks being the uber-novice!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:25 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07460 seconds
  • Memory Usage 2,249KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (1)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete