Membergroup Icon Image filename on custom theme

Started by Lord991, January 14, 2024, 04:17:51 PM

Previous topic - Next topic

Lord991

Hello guys, I created a copy of Curve2 theme to make a custom one based on Curve. I have two questions:

1. Do I need to make some changes for my theme to work correct (I edited theme_info.xml..)?

2. I noticed that in Membergroup section, Icon image filename: I only see Themes/default/images/membericons/ hard coded and a drop-down menu. Shouldn't I have a theme URL rather than Themes/default folder as hard coded if its a custom theme ?

Thanks a lot! :)

Sir Osis of Liver

If you edited theme_info.xml correctly you should be able install your theme as an additional theme. 

If you want to use a different membericon in custom theme, upload it to /Themes/yourtheme/images/membericons/ with same filename.  IOW, iconadmin.png is red in Curve2.  If you want to use a purple icon, upload the image to /Themes/yourtheme/images/membericons/ as iconadmin.png.  You'll still see red icon in Curve2, purple icon in custom theme.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Kindred

I usually just use the admin option to create a duplicate theme -- that automatically copies the minimum necessary files -- and then edit that
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

The reason is that it looks in the *default* theme folder for the list of image filenames on the theory that if you have different themes, you still want one consistent set of names so there's an image every time.

So for just starting out you'll want an iconadmin.png, iconmod.png, icongmod.png and icon.png for the standard groups.

If you added more groups of your own, you'll want to make new images (presumably with new names) in your site's theme, but also you'll need to add at least *some* file to the default theme to populate the drop-down.

At least, I'm assuming you're doing this for your own site rather than making a theme for other people, because if you're making a theme for other people, you replace those 4 images in your theme with ones named the same and you're done.

Deaks

Quote from: Lord991 on January 14, 2024, 04:17:51 PMHello guys, I created a copy of Curve2 theme to make a custom one based on Curve. I have two questions:

1. Do I need to make some changes for my theme to work correct (I edited theme_info.xml..)?


this would depend on how you created the copy, if you just copied the default folder then yes you would need to make a new theme)info.xml (just get from any theme on themesite and modify it to suit your needs)  if you created theme through how Kindred does it then you will be fine.  For ease I do the same way as Kindred as that way it only copies the files I would need as doing a direct copy of default theme folder you are not likley going to need 99% of the .template files
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Lord991

Quote from: Kindred on January 14, 2024, 05:37:40 PMI usually just use the admin option to create a duplicate theme -- that automatically copies the minimum necessary files -- and then edit that

Yeah I did the same, I just created a copy of default one that was Curve2 trough admin panel option in Manage and Install themes, it made a copy of all files in my "NewTheme" folder and all but I'm confused why its still showing url to default theme membergroups rather than Themes/NewTheme/images/membericons/ ?

For example if I wanted to publish that theme, or install it on different forum, what would happen if I had custom membergroup icons for that theme ?

Thx guys.

Arantor

If you wanted to publish the theme, you replace the 4 standard images as I said (because that's all you can *know* will exist) and call it a day.

Lord991

Sorry, maybe you don't understand my question.



Shouldn't here be Themes/NewTheme/images/membericons/ ?

Deaks

is your new theme set to be the forum default?  Memory is correct it should call from the forum defualt theme.
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."


Arantor

Quote from: Lord991 on January 15, 2024, 07:51:08 AMSorry, maybe you don't understand my question.



Shouldn't here be Themes/NewTheme/images/membericons/ ?

I understood your question, both times I answered it. You haven't understood my answer, but maybe I didn't explain it well enough.

The answer is still no, because it's still going to look in the default theme folder for the *filename to use for that group*.

iconadmin.png is the name used for the admin group, when using the default theme, the image with that filename is used from the default theme, when the custom theme is used, it'll use iconadmin.png from the custom theme.

But either way, the place it references to build the drop-down is the default theme.

This is because no matter what themes you have, you really need to have a consistent set of filenames so the images work *regardless of theme* and since the default theme is the only one SMF can guarantee will *always* be there, it refers to that.

Same way it does for the smileys that you have the same filenames across every set.

Lord991

Thank you, Arantor. I now understand!

Essentially, I can have my member group icons in a custom theme. However, I need to copy them to the default theme folder for them to appear, which I have done, and they are working fine.

I just wanted to confirm with you whether I made any mistakes with my theme. In version 2.0.19, there was a custom theme URL, but never mind.

Thanks again for your help! :)

Julius_2000

May I add one thing? If you would like to add another image format, pehaps a more modern one like svg or heic, you can do so by adding that format to Sources/ManageMembergroups.php

where it says:

// Get a list of all the image formats we can select.
$imageExts = array('png', 'jpg', 'jpeg', 'bmp', 'gif' , 'svg');

Arantor

It's 2024, time to drop bmp by standard (because modern browsers want nothing to do with it), WebP is well established as is SVG. HEIC isn't yet everywhere.

Advertisement: