Support Forum
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!
Simple: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.
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...
Visit Cruise Talk Central and Mr Papa's World
Simple: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.
it shouldnt be... its an argument to the sp_PmInboxButton() function, so change it just like you did the button..
Visit Cruise Talk Central and Mr Papa's World
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!
Simple: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.
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')); }
Visit Cruise Talk Central and Mr Papa's World
Simple: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.
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')); }
Simple: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.
ah, yes... that would be correct... glad it worked!
Visit Cruise Talk Central and Mr Papa's World
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.
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!
Simple: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.