Hello, I'm trying to add an icon for PM in the bar I created that can be seen here:
The thing is that I want the icon to be changed if the user has new PMs. and maybe add a tooltip that says that?
All I need is something to change the code there if the user has new messages.
This is not a plugin request.
You can always track the value of {$mybb->user['pms_unread']} and drive through jQuery or CSS classes to reflect required modifications at the desired location.
it says requests for plugins and modifications, so I thought it was for this too.
And that's what I need, the code to do that.
bump.
So, I've done this: but I don't know what to do next since it doesn't work:
var unreadPMs = "{$mybb->user['pms_unread']} ";
var image = document.getElementById('inboxmsg');
if unreadPMs >= 1 {
image.src = "images/new messages.png";
} else {
image.src = "images/no messages.png";
}
Or you could use a css solution
sample html
<span id="unread_pms_{$mybb->user['pms_unread']}"></span>
css
span[id*="unread_pms_"] {
vertical-align:middle;
background-image:url(../../../images/<mythemeimagefolder/new_message.png);
background-repeat:no-repeat;
background-position:center center;
display:inline-block;
width:22px;
height:16px;
}
span#unread_pms_0 {
background-image:url(../../../images/<mythemeimagefolder/no_message.png);
}
Also change width and height values to values of your message image.
Sigh, done, had to instal PHP in Templates and change the code to this:
<if $mybb->user['pms_unread'] == 0 then><img id="inboxmsg" height="15px" src="images/no_msg.png">
<else><img id="inboxmsg" height="15px" src="images/new_msg.png"></else></if>