Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Highlighting Watch/Subscribe and PM Inbox buttons when content is present
Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Apr 23, 2012 - 9:26 am

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

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Apr 23, 2012 - 10:32 am

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.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Apr 23, 2012 - 11:09 am

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

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 23, 2012 - 1:27 pm

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

Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Apr 23, 2012 - 3:43 pm

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

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 23, 2012 - 3:48 pm

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)...

Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Apr 23, 2012 - 7:12 pm

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

Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Apr 23, 2012 - 8:26 pm

Nah couldn't wait.

Highlighted_PM_Inbox.pngImage Enlarger

kiss

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 23, 2012 - 9:24 pm

so, that's what you wanted?  cool...

Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Apr 24, 2012 - 7:23 am

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?

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625