News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Membergroup Colors In Posts (a solution....or quick fix)

Started by SeaOfSin, July 26, 2005, 01:09:56 PM

Previous topic - Next topic

SeaOfSin

Since the Membergroup Colors In Posts mod isn't being looked after at this moment until they have more time, I figured I'd try and find a solution.  This isn't an exact copy of the mod, more of a quick fix. I have tested it in 1.1b3p but not 1.05 (maybe someone can tell me if it will work?)

So here is what you need to do

open

Display.template.php and find


// Show information about the poster of this message.
echo '
<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
<tr>
<td valign="top" width="16%" rowspan="2" style="overflow: hidden;">
<b>', $message['member']['link'], '</b>
<div class="smalltext">';

// Show the member's custom title, if they have one.
if (isset($message['member']['title']) && $message['member']['title'] != '')
echo '
', $message['member']['title'], '<br />';

// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';

// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
echo '
', $message['member']['post_group'], '<br />';
echo '
', $message['member']['group_stars'], '<br />';


and replace with


// Show information about the poster of this message.
echo '
<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
<tr>
<td valign="top" width="16%" rowspan="2" style="overflow: hidden;">
<b>', $message['member']['link'], '</b>
<div class="smalltext">';

// Show the member's custom title, if they have one.
if (isset($message['member']['title']) && $message['member']['title'] != '')
echo '
', $message['member']['title'], '<br />';

// Show the member's primary group (like 'Administrator') if they have one.
if(isset($message['member']['group']) && $message['member']['group'] != '' && isset($message['member']['group_color']))
{
echo '
<span style="color : ', $message['member']['group_color'] ,';"><b>', $message['member']['group'], '</b></span><br />';
}

// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')

echo '
   <span style="color : ', $message['member']['post_group_color'] ,';"><b>', $message['member']['post_group'], '</b></span><br />';
echo '
', $message['member']['group_stars'], '<br />';


and it should look something like



Any problems let me know, but I haven't seen any yet :)

Sea Of Sin


eohjay

I get this:

"Template Parse Error!
There was a problem loading the /Themes/default/Display.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme."

When trying to use it with the newest SMF version. I would really like to get this working, though, would anyone be able to give me a hand?

ディン1031

hmmm a easier way is edit groups and change the name for the group to something like <font color=#FF0000>Admin</font> and you've color the group XD, okay it's not automatic but it work :).

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

ernomo98

Quote from: din1031 on November 07, 2005, 01:22:04 AM
hmmm a easier way is edit groups and change the name for the group to something like <font color=#FF0000>Admin</font> and you've color the group XD, okay it's not automatic but it work :).

Bye
DIN1031

yes you have colour in the nickname, but not not in the posts, in each message that you write, it is your nickname, and there doesn't appear colorful.

SeaOfSin

Sorry for the delay, but I've been away.  This is a copy of what I use upto 1.1b3 and works for me.


// Show information about the poster of this message.
echo '
<table width="100%" cellpadding="0" cellspacing="0" style="table-layout: fixed;">
<tr>
<td valign="top" width="16%" rowspan="2" style="overflow: hidden;">
<b>', $message['member']['link'], '</b>
<div class="smalltext">';

// Show the member's custom title, if they have one.
if (isset($message['member']['title']) && $message['member']['title'] != '')
echo '
', $message['member']['title'], '<br />';

// Show the member's primary group (like 'Administrator') if they have one.
if(isset($message['member']['group']) && $message['member']['group'] != '' && isset($message['member']['group_color']))
{
echo '
<span style="color : ', $message['member']['group_color'] ,';"><b>', $message['member']['group'], '</b></span><br />';
}

// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')

echo '
   <span style="color : ', $message['member']['post_group_color'] ,';"><b>', $message['member']['post_group'], '</b></span><br />';
echo '
', $message['member']['group_stars'], '<br />';


I'll look into 1.1rc1 and let you know. :)

Sea Of Sin

SeaOfSin

OK, there is a difference in RC1.  >:( This is what you have to do  :)

find

// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';


replace with

// Show the member's primary group (like 'Administrator') if they have one.
if(isset($message['member']['group']) && $message['member']['group'] != '' && isset($message['member']['group_color']))
{
echo '
<span style="color : ', $message['member']['group_color'] ,';"><b>', $message['member']['group'], '</b></span><br />';
}


and find

// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
echo '
', $message['member']['post_group'], '<br />';
echo '
', $message['member']['group_stars'], '<br />';


replace with

// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')

echo '
   <span style="color : ', $message['member']['post_group_color'] ,';"><b>', $message['member']['post_group'], '</b></span><br />';
echo '
', $message['member']['group_stars'], '<br />';


:)

Sea Of Sin

ernomo98


Elmacik

Home of Elmacik

SeaOfSin

Try This:


// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';

replace

// Show the member's primary group (like 'Administrator') if they have one.
if(isset($message['member']['group']) && $message['member']['group'] != '' && isset($message['member']['group_color']))
{
echo '
<span style="color : ', $message['member']['group_color'] ,';"><b>', $message['member']['group'], '</b></span><br />';
}

and find

// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
echo '
', $message['member']['post_group'], '<br />';
echo '
', $message['member']['group_stars'], '<br />';


replace

// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')

echo '
   <span style="color : ', $message['member']['post_group_color'] ,';"><b>', $message['member']['post_group'], '</b></span><br />';
echo '
', $message['member']['group_stars'], '<br />';


This is tested in RC1 but should work on any template! :)

Sea Of Sin

ernomo98


Stuart

Quote from: din1031 on November 07, 2005, 01:22:04 AM
hmmm a easier way is edit groups and change the name for the group to something like <font color=#FF0000>Admin</font> and you've color the group XD, okay it's not automatic but it work :).

Bye
DIN1031

I just used this code which works perfectly fine, thanks  ;D

Advertisement: