Advertisement:

Author Topic: [TIP] Call core features icon by theme (fix for 2.0.x bug)  (Read 4971 times)

Offline Antechinus

  • SMF Friend
  • SMF Master
  • *
  • Posts: 25,505
  • Master of BBC Abuse
[TIP] Call core features icon by theme (fix for 2.0.x bug)
« 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>' : '', '

« Last Edit: January 17, 2015, 04:35:48 PM by Antechinus »

kat

  • Guest
Re: [TIP] Call core features icon by theme (fix for 2.0.x bug)
« Reply #1 on: January 17, 2015, 04:29:41 PM »
* K@ wonders why he doesn't have that line of code in his file...

Something similar, though...

Code: [Select]
<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:

Code: [Select]
<img class="features_image png_fix" src="', $settings['images_url'], '/admin/feature_', $id, '.png" alt="', $feature['title'], '" />
Well, nothing broke, at least... :)

Offline Antechinus

  • SMF Friend
  • SMF Master
  • *
  • Posts: 25,505
  • Master of BBC Abuse
Re: [TIP] Call core features icon by theme (fix for 2.0.x bug)
« Reply #2 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.
« Last Edit: January 17, 2015, 04:46:23 PM by Antechinus »

kat

  • Guest
Re: [TIP] Call core features icon by theme (fix for 2.0.x bug)
« Reply #3 on: January 17, 2015, 04:53:51 PM »
Oh bother.

That was a bit refined, for you! ;)

Ta, Ant!