Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Alexandre P. on November 14, 2004, 02:57:20 PM

Title: Applying membergroup color to every username
Post by: Alexandre P. on November 14, 2004, 02:57:20 PM
Hi all,

I got someone (http://www.simplemachines.org/community/index.php?topic=19446.msg157318#msg157318) who would like to know if it's possible to apply the membergroups colors (the ones shown on names in the section Who's Online) to every usernames, everywhere they appear ? (so, not only in Who's Online, but also in post display, etc.)

I believe you will need to modify the source code directly, not only the theme...

Thanks
Title: Re: Applying membergroup color to every username
Post by: Meriadoc on November 15, 2004, 12:22:11 AM
yeah, shouldn't be a semi-easy line by line bit - just in a lot of places. I can try to find all the places and post it for him/her (didn't check :)) tomorrow. Feel free to modify my french then ;)
Title: Re: Applying membergroup color to every username
Post by: Alexandre P. on November 15, 2004, 12:54:32 AM
It's him ;)
Thanks for checking, Merry :)
Title: Re: Applying membergroup color to every username
Post by: Meriadoc on November 15, 2004, 06:53:13 PM
on second look, it isn't quite a simple find/add bit. some places would require either a modified query or added query (the way of doing member group colors has changed since I last saw). plus there are a whole lot of places that would need these changes. It'd probably be better of as a mod, but I'm not sure how well it would go over because it changes a lot of files (think of all the places a membername shows up!)

so unless anyone else has any ideas...?
Title: Re: Applying membergroup color to every username
Post by: Burpee on November 15, 2004, 08:53:17 PM
I'd like seeing this too...
Don't have a clue on how to do this w/o modifying a lot of files though...
Title: Re: Applying membergroup color to every username
Post by: Anguz on November 16, 2004, 02:21:57 AM
Can't it be done from Load.php before it's saved in $context?
Title: Re: Applying membergroup color to every username
Post by: Meriadoc on November 16, 2004, 03:14:41 AM
unless I've missed something, $context is, at least in this area, for the user browsing - ie, it's for your info. Not everyone else's.
So that'd be a no, I'll ask [unknown] if there is a nice way like this though
Title: Re: Applying membergroup color to every username
Post by: Grudge on November 17, 2004, 03:32:20 PM
This can normally be used by accessing the 'group_color' index for the member. Basically, whenever a user is loaded via loadMemberContext, 'group_color' will be available, this means (for example) MessageIndex, BoardIndex, Display, InstantMessage. Probably the easiest way to mod this is to edit this line of the function:


'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '">' . $profile['realName'] . '</a>',


To do the color as well - that one change will probably propagate to *most* of the board. Note that the color to do that is in $profile['member_group_color'] (In that function)
Title: Re: Applying membergroup color to every username
Post by: Meriadoc on November 17, 2004, 03:54:59 PM
replace
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '">' . $profile['realName'] . '</a>',
with
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '"><span style="color: ' . $profile['member_group_color'] . '">' . $profile['realName'] . '</span></a>',

this will change the username links in the Display (individual threads) and InstantMessage for each personal message.

Thanks Grudge
Title: Re: Applying membergroup color to every username
Post by: shockeye on February 06, 2005, 03:45:27 PM
I made this change and nothing happened. I then went in and changed it from a span tag to a style tag inside the <a> and still nothing.

When I pull up the source for the renedered page, neither the style or the span tags appear. Am I missing something?
Title: Re: Applying membergroup color to every username
Post by: Burpee on February 07, 2005, 05:52:17 AM
Did you upload the right files? Did you modify the right theme? Did you remember to save before upload?
Title: Re: Applying membergroup color to every username
Post by: shockeye on February 07, 2005, 11:09:29 AM
It seems to be working. I didn't read exactly where the color would appear. It appears inside threads as advertised, I was expecting (hoping) it would appear in topic view I guess. My bad.
Title: Re: Applying membergroup color to every username
Post by: ShadowStriker on May 27, 2005, 06:58:29 PM
u have to edit the theme? all i did was edit load.php and it worked fine...
Title: Re: Applying membergroup color to every username
Post by: mank on June 01, 2005, 11:56:17 AM
I maually eddited alot of files on my site but it now works a treat. Thanks
Title: Re: Applying membergroup color to every username
Post by: ディン1031 on June 08, 2005, 03:52:14 PM
i would us this mod -> http://mods.simplemachines.org/index.php?mod=111 *runsandhid*