HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


How to Edit Usergroup Name Appearance

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#103200 (In Topic #20210)
Avatar

Community saint

ocPortal 9

Greetings,

Where does one find/edit the usergroup appearance?

I've googled and found an old thread back in the days of ocP 4 that mentioned the ocf.css, so of course I looked there first - both in my theme and default - but found nothing that jumped out at me.

So could someone please point it out for me the line I'm looking for or the right file if it was changed? I'd much appreciate it!

Legends of Nor'Ova: A site powered by ocPortal; home of the Legends of Nor'Ova tabletop RPG wiki and community.

Like ocPortal? Want to thank Chris and gang somehow? Then help out in the chat room! It really needs your help! Just open it in a tab everytime you open your web browser, and when you hear a "ding", check it out!

"Those who want help should first be willing to give help."
Back to the top
 
Posted
Rating:
#103243
Avatar

Well-settled

Hi Mythus!

Would gladly help if I can, but I don't really understand what you mean by your term, "usergroup name appearance"!

Please would you describe what and where I'd be seeing this when viewing a page? (I'm guessing it's a text-string displayed in some block somewhere. Are you perhaps wanting to edit the styling of usergroup names as listed in the members-online block?)

Chances are you've by now solved this, but even so, it'd be valuable to have your comeback, as I'm putting together a tutorial on usergroup management for my co-staff.

Regards,

Richard.


Last edit: by RichT
Back to the top
 
Posted
Rating:
#103248
Avatar

Well-settled

If my guess about styling the names of usergroups was right, the relevant selectors  are in ocf.css, lines 833-877, starting with a.ocf_gcol_1, a.ocf_gcol_1:visited, a.ocf_gcol_1:hover . If you're using the out-of-the-box Tempcode $GET,gcol variables (which relate to the "color" property only), edit the values for these these via lines 6-21. If I were wanting to edit any other style properties, I'd add their declarations to the individual selectors themselves.

Easiest way of telling which selector controls which usergroup's styling is to right-click on a particular usergroup name, and choose "Inspect element" - the gcol selectors appear close to the top of your Developer Tool's right-hand pane and should display the colour and hex or rgb value of your inspected element.

Hope this is of some use!

Richard.
Back to the top
 
Posted
Rating:
#103464
Avatar

Community saint

Sorry, wife was in hospital and I was with her.

Let me check this out and I will comment if I proved successful. For the record, its the names appearing in the users online block on the forums.

Legends of Nor'Ova: A site powered by ocPortal; home of the Legends of Nor'Ova tabletop RPG wiki and community.

Like ocPortal? Want to thank Chris and gang somehow? Then help out in the chat room! It really needs your help! Just open it in a tab everytime you open your web browser, and when you hear a "ding", check it out!

"Those who want help should first be willing to give help."
Back to the top
 
Posted
Rating:
#103465
Avatar

Community saint

It seems that my user group (administrator) shares the same css attribute as another membergroup that is not administrator.

They both reference a.ocf_gcol_3

How can I change that? Administrator group should be a different color than normal point rank based groups. Is there a place that assigns the attributes to specific usergroups?

Legends of Nor'Ova: A site powered by ocPortal; home of the Legends of Nor'Ova tabletop RPG wiki and community.

Like ocPortal? Want to thank Chris and gang somehow? Then help out in the chat room! It really needs your help! Just open it in a tab everytime you open your web browser, and when you hear a "ding", check it out!

"Those who want help should first be willing to give help."
Back to the top
 
Posted
Item has a rating of 5 (Liked by Jean)  
Rating:
#103467
Avatar

Community saint

I think what you are running into is you probably have more than 15 usergroups. By default ocPortal only has group color definitions for 15 groups and so the colors get recycled for groups higher than the first 15. The group colors are defined in ocf.css and in sources\ocf_general.php (get_group_colour function). The only thing I got, off the top of my head, would be to create an override of the get_group_colour function and extend the $all_colours array out for as many usergroups as you need. The easy way would be to extend the array and recycle the colors except for the first three like this:


Code


 // Override to add group color definitions for more than 15 usergroups and keep group 1,2, and 3 unique.
 
function get_group_colour($gid)
{
$all_colours=array('ocf_gcol_1','ocf_gcol_2','ocf_gcol_3','ocf_gcol_4','ocf_gcol_5','ocf_gcol_6','ocf_gcol_7','ocf_gcol_8','ocf_gcol_9','ocf_gcol_10','ocf_gcol_11','ocf_gcol_12','ocf_gcol_13','ocf_gcol_14','ocf_gcol_15','ocf_gcol_4','ocf_gcol_5','ocf_gcol_6','ocf_gcol_7','ocf_gcol_8','ocf_gcol_9','ocf_gcol_10','ocf_gcol_11','ocf_gcol_12','ocf_gcol_13','ocf_gcol_14','ocf_gcol_15');
return $all_colours[$gid%count($all_colours)];
}
 


Just put that code in a new file called ocf_general.php and place it in the sources_custom directory.

You'll notice after the first 'ocf_gcol_15', I repeated the pattern but started again with 'ocf_gcol_4'. This code should work for 27 usergroups. If you need more, just keep extending the array as I did. Making sure not to recycle ocf_gcol_1, ocf_gcol_2, or ocf_gcol_3 so Guests, Admins, and Super Moderators all get their own unique color (assuming those usergroups haven't been rearranged from their default ID's).

Or (a bit more difficult) if you want ALL groups to have unique colors, instead of repeating the pattern and recycling the ocf_gcol_#, you would extend it on from 'ocf_gcol_15' with 'ocf_gcol_16', 'ocf_gcol_17', and so on. But then you also need to add those new definitions with their own custom color codes to the ocf.css file as well. 

<EDIT>
I suppose it would also be possible to alter the function to dynamically generate the array by getting a count of the number of usergroups there are.


Last edit: by Jason Verhagen
Back to the top
 
Posted
Item has a rating of 5 (Liked by Jason VerhagenLiked by Jean)  
Rating:
#103468
Avatar

Well-settled

Hi Mythus - really sorry to learn of your wife's illness, and I do hope she's now recovering well.

3 alternative things I'd try first (start with 1, which is the least predictably successful) - all in ocf.css:
  1. change the a.ocf_gcol_3 "color" property to an absolute, hex-value colour that specifies the admin colour you want (comment out the braced value!)
  2. enclose the whole rule within a Tempcode filter like {+START,IF,{$NOT,{$IS_IN_GROUP,n}}}, replacing n with the id number of the non-admin usergroup, change the "color" property to the hex value you want for admins as per 1 above, and add {+END} immediately after the rule. (You might achieve the same filtering using {+START,IF{$IS_STAFF}}....{+END} instead)
  3. Follow the existing rule with a duplicate (i.e. also named a.ocf_gcol_3). Preserve the filtered version created in 2., above, and enclose the duplicate rule within {+START,IF,{$NOT,{$IS_IN_GROUP,2}}} (Note: 2 is the admin usergroup id number) specifying the "color" property for the non-admin usergroup as a hex value matching the normal, expected colour for that group. As always, add {+END} immediately after the rule.
Hope this helps - looking forward to your news.

Richard.


Last edit: by RichT
Back to the top
 
Posted
Item has a rating of 5 (Liked by RichT)  
Rating:
#103469
Avatar

Community saint

That's a good one Richard. I like option #2. Though I would probably also create the same thing for groups 1 and 3 as well. Placing this in an ocf.css override in css_custom a no_cache.css override in css_custom and at the end of the file if you already have an override should work, but not tested:

Code

{+START,IF,{$NOT,{$IS_IN_GROUP,1}}}
a.ocf_gcol_1, a.ocf_gcol_1:visited, a.ocf_gcol_1:hover {
color: enter you color hex code here;
}{+END}
 
{+START,IF,{$NOT,{$IS_IN_GROUP,2}}}
a.ocf_gcol_2, a.ocf_gcol_2:visited, a.ocf_gcol_2:hover {
color: enter you color hex code here;
 
}{+END}
 
{+START,IF,{$NOT,{$IS_IN_GROUP,3}}}
a.ocf_gcol_3, a.ocf_gcol_3:visited, a.ocf_gcol_3:hover {
color: enter you color hex code here;
 
}{+END}
​​​​​​​


The existing definitions remain untouched, and these new ones go in an override or placed somewhere below the existing gcol definitions a no_cache.css override. Doing it that way, they will override the earlier definitions if they get triggered. The {$GET,gcol_#} in the {+START}{+END} parts can be set to whatever colors you want, I just chose to recycle three existing colors. Enter your color hex codes in the code above and they will be used for group numbers higher than 15. If I did that right, a Guest would get color gcol_1 and anybody else not in Guest group 1 trying to get a Guest group color would get the new color instead. An admin would get gcol_2 and anybody else not in Admin group 2 trying to get Admin group color would get the new color instead. etc...

<EDIT>
Edited to correct override file name.

<EDIT #2>  
Removed the {$GET} tempcode from the .css since I'm fairly certain they won't work from the no_cache.css without defining the gcol_# variables there as well. Instead of defining the gcol_# variables, just replace the {$GET} tempcode stuff with the actual hex codes or color names you want to use. These colors should be used for any usergroup with an ID higher than 15. 


Last edit: by Jason Verhagen
Back to the top
 
Posted
Item has a rating of 5 (Liked by Jason VerhagenLiked by Jean)  
Rating:
#103471
Avatar

Placing this in an ocf.css override in css_custom and at the end of the file if you already have an override should work, but not tested:

It'd need to go in nocache.css, CSS is usually cached statically.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#103483
Avatar

Community saint

Thanks Chris! I also edited the code to remove the {$GET} tempcode since those variables will now be defined in another .css file.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: