Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
themes-topic
Changing Inbox Button Color If Unread Messages
Avatar
jim
Here and Now
Member
Pro Subscribers
sp_UserOfflineSmall Offline
Aug 30, 2015 - 2:03 pm

I've always wanted to change the background color for the PM Inbox button, if there are unread messages.

I know there is a style for the unread message count, and I have changed that number to red. But I'm wondering if there is a way to assign a different style to that button itself so it stands out more when the user has unread private messages.

It looks like all those buttons share the same style: #spMainContainer a.spButton

I'm thinking we could apply a new style like: #spMainContainer a.spButton-pmunread

Another option would be to just change the Inbox icon, if user has unread messages.

But I'm guessing there would need to be some sort of hook or trigger to call that style(s) when messages await...can you tell I'm over my head yet?

Any thoughts or direction are appreciated. Thanks!

Screen-shot-2015-08-30-at-11.20.56-AM.pngImage Enlarger

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 30, 2015 - 3:21 pm

two ways you could do this...

first, filter sph_PmInboxButton and change spButton to another class like you mention...

two, change the class in the call to pm inbox template tag from the theme head template file...

in both cases, you need to know if there are unread... so something like this:

    $newPM = sp_pm_get_inbox_unread_count($spThisUser->ID);

that will give you the count... so change

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

to

            if (function_exists('sp_PmInboxButton')) {
                $newPM = sp_pm_get_inbox_unread_count($spThisUser->ID);
                $class = ($newPM > 0) ? 'spButtonUnread' : 'spButton';
                sp_PmInboxButton("tagClass=$class spRight", __sp('Inbox:'), __sp('Go to PM inbox'));
            }

and see if that does the trick...

Avatar
jim
Here and Now
Member
Pro Subscribers
sp_UserOfflineSmall Offline
Aug 30, 2015 - 4:41 pm

Mr Papa said
...see if that does the trick...

That was fun.

Screen-shot-2015-08-30-at-2.29.00-PM.pngImage Enlarger

 

I'll need to come up with something more challenging next time...

Changing the inbox icon is proving to be a bit more tricky! wink

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 30, 2015 - 4:53 pm

it shouldnt be... its an argument to the sp_PmInboxButton() function, so change it just like you did the button..

Avatar
jim
Here and Now
Member
Pro Subscribers
sp_UserOfflineSmall Offline
Aug 30, 2015 - 6:23 pm

Mr Papa said
...its an argument to the sp_PmInboxButton() function...

So I thought, but I am not finding how or where the actual image file is being assigned or called. A search of all /simple-press and /reboot files for sp_PmInboxButton.png yields no results.

No biggie, but now I am curious!

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 30, 2015 - 7:06 pm

something like this:

            if (function_exists('sp_PmInboxButton')) {
                $newPM = sp_pm_get_inbox_unread_count($spThisUser->ID);
                $icon = ($newPM > 0) ? 'sp_PmInboxButton.png' : 'sp_PmInboxButtonUnread.png';
                $class = ($newPM > 0) ? 'spButtonUnread' : 'spButton';
                sp_PmInboxButton("tagClass=$class spRight&icon=$icon", __sp('Inbox:'), __sp('Go to PM inbox'));
            }
Avatar
jim
Here and Now
Member
Pro Subscribers
sp_UserOfflineSmall Offline
Aug 30, 2015 - 8:07 pm

Sweeet... y'all make it look so easy.

SpPmButton_Read-Unread.pngImage Enlarger

 

Thanks for the lesson!

If anyone ever questions the value of a SimplePress membership, tell them to message me.cool

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Avatar
jim
Here and Now
Member
Pro Subscribers
sp_UserOfflineSmall Offline
Aug 30, 2015 - 8:12 pm

FYI: I just had to swap the icon $icon files as follows to get the right one to display for unread messages...

            if (function_exists('sp_PmInboxButton')) {
                $newPM = sp_pm_get_inbox_unread_count($spThisUser->ID);
                $icon = ($newPM > 0) ? 'sp_PmInboxButtonUnread.png' : 'sp_PmInboxButton.png';
                $class = ($newPM > 0) ? 'spButtonUnread' : 'spButton';
                sp_PmInboxButton("tagClass=$class spRight&icon=$icon", __sp('Inbox:'), __sp('Go to PM inbox'));
            }

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 30, 2015 - 11:29 pm

ah, yes... that would be correct...  glad it worked!

Avatar
jim
Here and Now
Member
Pro Subscribers
sp_UserOfflineSmall Offline
Dec 9, 2018 - 8:20 pm

Mr Papa said
...glad it worked!

Me too! But unfortunately it breaks in SP 6.0.

I actually forgot we did this, and submitted a private ticket after getting an Invalid Database Query error on all forum pages after activating the updated Private Messaging plugin.

I'm hoping we can get this working again, and am posting here publicly for anyone else who may have implemented this or those who may want to.

rebootkid (child theme) spHeadDesktop.php:111

This worked for us with SP 5.x using the attached image.

sp_PmInboxButtonUnread.png

if (function_exists(‘sp_PmInboxButton’)) {
$newPM = sp_pm_get_inbox_unread_count($spThisUser->ID);
$icon = ($newPM > 0) ? ‘sp_PmInboxButtonUnread.png’ : ‘sp_PmInboxButton.png’;
$class = ($newPM > 0) ? ‘spButtonUnread’ : ‘spButton’;
sp_PmInboxButton(“tagClass=$class spRight&icon=$icon”, __sp(‘Inbox:’), __sp(‘Go to PM inbox’));
}

It no longer works in SP 6.x so we reverted the the following copied from the Reboot 2.0 parent theme...

Reboot v.2.0 spHeadDesktop.php:111

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

Would love to get that working again...thanks!

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

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: 649
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 616
Members: 17344
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10117
Posts: 79600