News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Change PM Indicator Color

Started by Texan78, August 09, 2012, 02:08:19 PM

Previous topic - Next topic

Texan78

Hello,

How would I go about changing the color of the PM indicator?

For example it currently shows like this [1]

I would like for it to show like this [ 1 ]

Where would I change this?

-Thanks

Chas Large

This number being bold is controlled by the "strong" element within the CSS, so add something like color: red; or the hex code will change it BUT it will also change it for anything else that is set as Strong/bold.

strong {
    color: red;
    font-weight: bold;
}


The colour is taken from the default body colour in the CSS

The display of this is controlled by the action=pm which you might be able to recode so that only when that's called does the colour get changed. I can't remember where that action is programmed though, sorry.
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Texan78

Quote from: Chas Large on August 09, 2012, 02:53:33 PM
The display of this is controlled by the action=pm which you might be able to recode so that only when that's called does the colour get changed. I can't remember where that action is programmed though, sorry.

Thanks, that would be the best option. I have been looking for it but I can't find it. If I could find it then I could assign a new class to it just for the indication.

-Thanks!

Chas Large

Yeah, I've been searching too. It should be in a template but I just cant figure it out where... :-\
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

MovedGoalPosts

http://www.simplemachines.org/community/index.php?topic=478980.0

That tip might give some clues.  On the other hand I couldn't get that tip to work for me :(

Sir Osis of Liver


I do it in /Sources/Subs.php -



$context['menu_buttons']['pm']['alttitle'] = $context['menu_buttons']['pm']['title'] . ' [' . $context['user']['unread_messages'] . ']';

/// Make number of messages red on 'Messages' menu button
$context['menu_buttons']['pm']['title'] .= '<span style="color: #ff0000;"> [<strong>' . $context['user']['unread_messages'] . '</strong>]</span>';
}



When in Emor, do as the Snamors.
                              - D. Lister

Texan78

Quote from: Krash. on August 09, 2012, 03:49:11 PM

I do it in /Sources/Subs.php -



$context['menu_buttons']['pm']['alttitle'] = $context['menu_buttons']['pm']['title'] . ' [' . $context['user']['unread_messages'] . ']';

/// Make number of messages red on 'Messages' menu button
$context['menu_buttons']['pm']['title'] .= '<span style="color: #ff0000;"> [<strong>' . $context['user']['unread_messages'] . '</strong>]</span>';
}



Thanks everyone for the suggestions and replies. With the help above I have located the code. Instead of using span style I made a class for it. Both works great, just like using CSS so it's neater. Anyways, ether way from the code above or the code I used below it breaks the format as you can see in the screenshot. What could be causing this just from adding style?

$context['menu_buttons']['pm']['title'] .= ' [<div class="pm_indicator">' . $context['user']['unread_messages'] . '</div>]';



Any ideas or suggestions?

-Thanks!

mashby

What is the code you edited? And how did you make the elements in CSS?
Always be a little kinder than necessary.
- James M. Barrie

Texan78

This is the code I edited...

$context['menu_buttons']['pm']['title'] .= ' [<strong>' . $context['user']['unread_messages'] . '</strong>]';
}


I changed it to this, just replacing the strong inline element with a div class like this....

$context['menu_buttons']['pm']['title'] .= ' [<div class="pm_indicator">' . $context['user']['unread_messages'] . '</div>]';
}


Created the css as follows...

.pm_indicator
{
font-weight:bold;
        color:#ff0000;
}


-Thanks!


mashby

Maybe this?
.pm_indicator
{
font-weight:bold;
        color:#ff0000;
        display:inline;
}
Always be a little kinder than necessary.
- James M. Barrie

Texan78

Ah yes that worked perfectly and did the trick. Looks great and exactly what I am looking for.



Thanks to you and everyone for their help and suggestions!

-Thanks!

Chas Large

Good that you sorted it and well done in posting the feedback and thanks. Makes a pleasant change to get the simple reward of a Thank You when the team help out.
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Advertisement: