MyBB Community Forums

Full Version: Alert Icon To Show Red When There is An Alert
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does anyone know how I can change the Alert icon color to RED so that it's easier for users to notice that they have alerts?

As you can see in the screenshot below... I have an alert, but the alert icon did not turn RED or at least the number didn't turn red. 

[Image: 78055853f7765dcba2f56676e3d38a88.png]

When the user views the alert, I would like the alert icon (or the number) to revert back to the normal color.

I did contact the author of this theme, but he does not know how to do this.

Any thoughts?
you can do it with php in templates:

<if {variable} > 0 then>
<span class="red">...................</span>
<else>
<span class="normal">...................</span>
</if>
I'd have given you a CSS solution if I could see the elements, but your site returning me default theme ...
(2018-08-16, 08:16 AM)effone Wrote: [ -> ]I'd have given you a CSS solution if I could see the elements, but your site returning me default theme ...

I've PMed you login details for my website.

Had I known that you were going to do this, I would have set up a temp account for you.

(2018-08-16, 02:05 AM)Ashley1 Wrote: [ -> ]you can do it with php in templates:

<if {variable} > 0 then>
 <span class="red">...................</span>
<else>
 <span class="normal">...................</span>
</if>

Thanks Ashley, but I know nothing about coding. 

That's why I have to rely on "outside help" for this kind of thing.
I have my alert icon disappear when there are no alerts using a similar method to Ashley1 method, and truly alerts members when they have an alert; ditto with messages - works great

You do need the Template Conditionals Plugin though Smile

For reference

In myalerts_headericon template >

<if $mybb->user['unreadAlerts'] == 0 then>
	
<else>

<a href="/alerts.php">
<span class="alerticon" onclick="/alerts.php">{$mybb->user['unreadAlerts']}</span></a>
	
</if>

Note that I have adjusted my code to send members to the alerts page instead of the pop-up model, and my CSS may be different.  You could just place everything in your current myalerts_headericon template in-between <else> & </if>
Alright, I have made necessary changes to your site. See if it is as per your requirement now.

Note that your CSS files were not reflecting changes instantly (probably for some caching) so I have placed the required CSS in templates only. Its fine there but if you wish you can move those CSS (2 lines) to suitable CSS files.
(2018-08-16, 08:17 PM)effone Wrote: [ -> ]Alright, I have made necessary changes to your site. See if it is as per your requirement now.

Note that your CSS files were not reflecting changes instantly (probably for some caching) so I have placed the required CSS in templates only. Its fine there but if you wish you can move those CSS (2 lines) to suitable CSS files.

Yes, the Alert icon did turn RED.

The caching thing is because I have Cloudflare and it's notorious for taking a while to cache. 

I'll leave it as is. If it works, I'm not going to mess with it.

UPDATE: I just checked the admin logs, now I see which template you modified. 
It wasn't the one that I was expecting, but now that I see how you did it, it makes sense to use that particular template.

Thanks!

You can close this thread.