Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Antechinus on January 17, 2015, 03:23:14 PM

Title: [TIP] Call core features icon by theme (fix for 2.0.x bug)
Post by: Antechinus on January 17, 2015, 03:23:14 PM
Most people probably won't worry about this, but 2.0.x has a bug (another one :D) in that although all 2.0.x themes include icons for the core features page, no theme will ever use them. This is because some bright spark (dunno who) coded Admin.template.php so that it will always call those icons from the default theme.*

If you've been wondering why you can't get custom icons on that page, now you know.

The fix is easy. Admin.template.php:

Code (Find) Select
<img class="features_image png_fix" src="', $settings['default_images_url'], '/admin/feature_', $id, '.png" alt="', $feature['title'], '" />

Code (Replace) Select
<img class="features_image png_fix" src="', $settings['images_url'], '/admin/feature_', $id, '.png" alt="', $feature['title'], '" />

I'm using this to load a custom set with lower opacity for a dark theme. Knocks the edge off the eye-burning glow. ;)


*Incidentally, this means every custom theme on the theme site has superfluous images in it.

ETA: Oh yeah, just checked and the same dopey code is in the part for the quick tasks icons too. To fix that:

Code (Find) Select
', !empty($task['icon']) ? '<a href="' . $task['href'] . '"><img src="' . $settings['default_images_url'] . '/admin/' . $task['icon'] . '" alt="" class="home_image png_fix" /></a>' : '', '


Code (Replace) Select
', !empty($task['icon']) ? '<a href="' . $task['href'] . '"><img src="' . $settings['images_url'] . '/admin/' . $task['icon'] . '" alt="" class="home_image png_fix" /></a>' : '', '


Title: Re: [TIP] Call core features icon by theme (fix for 2.0.x bug)
Post by: kat on January 17, 2015, 04:29:41 PM
/me wonders why he doesn't have that line of code in his file...

Something similar, though...

<img class="features_image png_fix" src="', $settings['default_images_url'], '/admin/feature_', $id, '.png" alt="', $feature['title'], '" />

**scratches head**

Maybe some mod played with it, ay?

I assume I change that to:

<img class="features_image png_fix" src="', $settings['images_url'], '/admin/feature_', $id, '.png" alt="', $feature['title'], '" />

Well, nothing broke, at least... :)
Title: Re: [TIP] Call core features icon by theme (fix for 2.0.x bug)
Post by: Antechinus on January 17, 2015, 04:33:50 PM
Oh bother. I was taking that from a custom template. Will edit OP to have the (equally silly) default code. :D

ETA: Done.

You can also remove the png_fix class, incidentally, since that is dinosaur code for old versions of IE.
Title: Re: [TIP] Call core features icon by theme (fix for 2.0.x bug)
Post by: kat on January 17, 2015, 04:53:51 PM
Quote from: Antechinus on January 17, 2015, 04:33:50 PM
Oh bother.

That was a bit refined, for you! ;)

Ta, Ant!