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
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 ;)
It's him ;)
Thanks for checking, Merry :)
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...?
I'd like seeing this too...
Don't have a clue on how to do this w/o modifying a lot of files though...
Can't it be done from Load.php before it's saved in $context?
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
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)
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
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?
Did you upload the right files? Did you modify the right theme? Did you remember to save before upload?
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.
u have to edit the theme? all i did was edit load.php and it worked fine...
I maually eddited alot of files on my site but it now works a treat. Thanks
i would us this mod -> http://mods.simplemachines.org/index.php?mod=111 *runsandhid*