Support Forum

Highlighting Watch/Subscribe and PM Inbox buttons when content is present

CF Conrad_Farlow
Conrad_Farlow
Member

I would like to highlight or change colour of the Watch/Subscribe and PM Inbox buttons when content is present. What would you suggest the easiest way to do that would be?

I was thinking of both a subtle colour change to the button background as well as a thicker border/glow effect.

Just looking for some pointers but it might be a nice feature for the future.

Conrad

15 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

That;s a good question. I can not at the moment find an ID attribute on those buttons and you would really need this. I have opened a ticket to get that added.

CF Conrad_Farlow
Conrad_Farlow
Member

Could you check to see if spWatchCountRead!=0 and chose a different image for the button or is that too simple? It’s another ‘make it obvious for the old boys’ requestcry

MP Mr Papa
Mr Papa
Member

not sure what you mean by spWatchCountRead…  not really a variable though you could read it from the DOM using jQuery (or js)…

if you are asking about doing it in the template file, you could check the watch count by:

        $newPM = spdb_count(SPPMMESSAGES, “to_id=$spThisUser->ID AND inbox=1 AND message_status=0”);

and then call the template tag with a different button based on the value of $newPM

CF Conrad_Farlow
Conrad_Farlow
Member

Great Steve.

Now you know what an utterly useless php person I am so an example of what you mean by the last line (including the if statement) would be most helpful wink

Only one example and then I’ll figure out how to duplicate it for the other buttons.

Pretty please smile

MP Mr Papa
Mr Papa
Member

in your template file (spHead.php for PM) find:

            if (function_exists('sp_PmInboxButton')) sp_PmInboxButton('tagClass=spButton spRight', 'Inbox:', 'Go to PM inbox');  

and replace with:

        $newPM = spdb_count(SPPMMESSAGES, "to_id=$spThisUser->ID AND inbox=1 AND message_status=0");
        if ($newPM > 0) {
            if (function_exists('sp_PmInboxButton')) sp_PmInboxButton('tagClass=spButton2 spRight', 'Inbox:', 'Go to PM inbox');                        
        } else {
            if (function_exists('sp_PmInboxButton')) sp_PmInboxButton('tagClass=spButton spRight', 'Inbox:', 'Go to PM inbox');            
        }

now, I ‘think’ I know what you are trying to do…  so you will have to define in your sp theme a new spButton2 class which is what the altered button will look like (vs spButton standard)…

CF Conrad_Farlow
Conrad_Farlow
Member

That is marvellous thanks very much Steve.

I’ll hopefully get chance to have a go at this tomorrow otherwise it will be Friday because I am travelling for work a little this weekcry

So much to do, so little time – er you’re probably not the best person to say that to though are you?

Conrad

CF Conrad_Farlow
Conrad_Farlow
Member

Just one anomaly.

As a PM inbox indicator of unread PMs when in any forum view everything works perfectly in all browsers.

However if you have 1 unread PM and then select the inbox botton and go and read the PM, the PM count goes to 0 but the button background remains as specified in the spButton2 class. Refreshing the page corrects the problem so I suspect that a little tweak is necessary. How can I correct this?

I was astonished to see that IE8 doesn’t do gradients! How rubbish is that?

YS Yellow Swordfish
Yellow Swordfish
Member

IE8 doesn’t do much to be honest. IE10 top come will be their first mainly standard-compliant browser although 9 came a long way forward.

For what you want now you will basically need to use Javascript. We have no hooks in javascript code – not even sure that would work that well. So you would need to create a javascript file and function, load it where you need it and find a way to monitor the button for changes so you could then apply style changes. And that’s a big learning curve!

BR Brandon
Brandon
Member

Conrad_Farlow said

I was astonished to see that IE8 doesn’t do gradients! How rubbish is that?

IE8 can do some gradients. For example you should be seeing gradient in the buttons here using IE8.

CF Conrad_Farlow
Conrad_Farlow
Member

Have you changed the way that gradients are done recently Brandon? In order to have the new spButton2 class I have added an alt8 section to my theme overlay.

The gradient is realised like this and of course the alt8SectionFrom and alt8SectionTo is also declared.

$alt8SectionGradient    = "-moz-linear-gradient(100% 100% 90deg, $alt8SectionTo, $alt8SectionFrom); background: -webkit-gradient(linear, 0% 0%, 0% 100%, from($alt8SectionFrom), to($alt8SectionTo)); background-color: $alt8SectionBase;";

This was copied from the alt1 section from a version of the default theme. All I get in IE8 is the alt8SectionBase colour on both the spButton and spButton2 classes which in my theme stylesheet like this:

#spMainContainer a.spButton,
#spMainContainer .spButtonAsLabel {
    width: auto;
    height: <?php echo($linkButtonHeight); ?>;
    text-align: center;
    line-height: <?php echo($controlLineHeight); ?>;
    padding: 1px 7px;
    margin: 2px 2px;
    font-size: <?php echo($spButtonAsLabel); ?>;
    font-family: <?php echo($buttonFontFamily); ?>;
    outline-style: none;
    color: <?php echo($alt4LinkColor); ?>;
    text-decoration: <?php echo($alt4LinkDecoration); ?>;
    cursor: pointer;
    background: <?php echo($alt1SectionBackGround); ?>;
    border: <?php echo($alt1SectionBorder); ?>;
    <?php echo($smallRadius); ?>
}
#spMainContainer a.spButton2,
#spMainContainer .spButtonAsLabel {
    width: auto;
    height: <?php echo($linkButtonHeight); ?>;
    text-align: center;
    line-height: <?php echo($controlLineHeight); ?>;
    padding: 1px 7px;
    margin: 2px 2px;
    font-size: <?php echo($spButtonAsLabel); ?>;
    font-family: <?php echo($buttonFontFamily); ?>;
    outline-style: none;
    color: <?php echo($alt4LinkColor); ?>;
    text-decoration: <?php echo($alt4LinkDecoration); ?>;
    cursor: pointer;
    border: <?php echo($alt8SectionBorder); ?>;
    background: <?php echo($alt8SectionBackGround); ?>;
    <?php echo($smallRadius); ?>

}

I’ll have a look at the latest themes to see what the changes are.

Conrad

BR Brandon
Brandon
Member

Yup, that part $alt1SectionBackGround was changed to create and include gradients for several different browsers.

See this post https://simple-press.com/support-forum/sp5-general-topics/add-link-to-topic/#p105217 and you will see the entry now for $alt1SectionBackGround.

It should be in all the latest overlays or CSS files.

CF Conrad_Farlow
Conrad_Farlow
Member

Found them all that

filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=$alt1SectionFrom, endColorstr=$alt1SectionTo,GradientType=0 );background: -ms-linear-gradient(top, $alt1SectionFrom 0%,$alt1SectionTo 100%); background: -o-linear-gradient(top,  $alt1SectionFrom 0%,$alt1SectionTo 100%); background: linear-gradient(top, $alt1SectionFrom 0%,$alt1SectionTo 100%)