News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Rank Image Drop Down

Started by NanoSector, February 11, 2013, 08:42:57 PM

Previous topic - Next topic

Jade Elizabeth

I have some questions.

1. My images are in images/badges, not in images/....is there a way I can specify that?

2. When you say default theme, you just mean it's loading from there, not that you're changing where they load from? Last I checked that was theme specific....so if I have different ones in each theme am I looking at loading only the defaults or is this only in the admin panel part?

3. Have you considered adding this to profiles?
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

NanoSector

1. Sure, five edits will have to be applied.

1. Sources/ManageMembergroups.php
Find:
if ($files = scandir($settings['default_theme_dir'] . '/images'))
Replace:
if ($files = scandir($settings['default_theme_dir'] . '/images/badges'))

2. Sources/ManageMembergroups.php
Find:
$ext = pathinfo($settings['default_theme_dir'] . '/images/' . $value, PATHINFO_EXTENSION);
Replace:
$ext = pathinfo($settings['default_theme_dir'] . '/images/badges/' . $value, PATHINFO_EXTENSION);

3. Sources/ManageMembergroups.php
Find:
$image_info = getimagesize($settings['default_theme_dir'] . '/images/' . $value);
Replace:
$image_info = getimagesize($settings['default_theme_dir'] . '/images/badges/' . $value);

4. Themes/default/ManageMembergroups.template.php
Find:
<img id="star_preview" src="', $settings['images_url'], '/', $context['group']['star_image'] == '' ? 'blank.gif' : $context['group']['star_image'], '" alt="*" />
Replace:
<img id="star_preview" src="', $settings['images_url'], '/badges/', $context['group']['star_image'] == '' ? 'blank.gif' : $context['group']['star_image'], '" alt="*" />

5. Themes/default/scripts/ridd.js
Find:
[code]document.getElementById('star_preview').src = smf_default_theme_url + '/images/' + ((select_box.value && star_count.value > 0) ? select_box.value : 'blank.gif');

Replace:
document.getElementById('star_preview').src = smf_default_theme_url + '/images/badges/' + ((select_box.value && star_count.value > 0) ? select_box.value : 'blank.gif');

Let me know if that works, and take backups :)

2. It's loading the image names from the default theme. It's possibly a bug, but me doing it this way means that I hit a barrier during the development. I'll take another look, put on my to-do list.

3. Membergroup stars can be set by an admin only, what do you want on the profile?
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Jade Elizabeth

Works amazingly!! :D

Thanks so much!!!
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Jade Elizabeth

Wait it's not quite there, it's submitting the image url as /images not images/badges. Did I miss something?
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

NanoSector

Eh, ups.

Themes/default/ManageMembergroups.template.php,
find:
<option value="', $star, '"', $context['group']['star_image'] == $star ? ' selected="selected"' : '', '>', $star, '</option>';

Replace with:
<option value="badges/', $star, '"', $context['group']['star_image'] == $star ? ' selected="selected"' : '', '>', $star, '</option>';

That should fix it.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Jade Elizabeth

Now that's working and the preview is not ha ha.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

NanoSector

Ah, undo the change to Themes/default/scripts/ridd.js :)
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Jade Elizabeth

Perfect! You rock, thank you so so much!! :D

You just seriously cut my work in half almost. Or at least made it easier! :D :-*
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Jade Elizabeth

Okay I am so sorry to do this... it's not selecting the right image... so when I edit a group that has an image the image is always reset to the first image listed (in this case admin). Can I fix that?
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

NanoSector

Any errors in your error log?
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Jade Elizabeth

Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

NanoSector

Does the image show correctly on profiles etc.?
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Jade Elizabeth

Yep, everywhere. It's just that the drop down is not taking into account that there was a image already picked I think?
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

NanoSector

Aha.

Themes/default/ManageMembergroups.template.php
Find...
<option value="badges/', $star, '"', $context['group']['star_image'] == $star ? ' selected="selected"' : '', '>', $star, '</option>';
Replace:
<option value="badges/', $star, '"', ($context['group']['star_image'] == 'badges/' . $star ? ' selected="selected"' : ''), '>', $star, '</option>';

Now it should work. :P
Sorry for the many attempts.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Jade Elizabeth

Hey it's not your fault, this is technical, and with all code it's basically trial and error ha ha.

It would be nice to consider a field for "where are badges kept" because I know some people keep them in the forum root...and I know a lot of people who keep them in folders like "badges" or "ranks". So yeah it may be worth investing in :D.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Arantor

And is that a per-theme folder or not? Bear in mind you can use a single central folder for all badges in all themes without a mod if you're careful.

Jade Elizabeth

Also another note, even before when it wasn't showing the right image....the image that shows when the page loads never previews right. Maybe to do with JS loading order or something? Anyway it shows a blank image when you edit, but it is working now otherwise. I am not worried too much I just thought I would let you know in case it happens with the regular version too :).

Quote from: ‽ on August 03, 2014, 10:58:23 AM
And is that a per-theme folder or not? Bear in mind you can use a single central folder for all badges in all themes without a mod if you're careful.

I'm not sure how to do that. TBH I really like it in the images folder in the themes. I don't like them anywhere else. Besides, what if I want a set of Christmas badges for my Christmas theme? (hint: I DO! :D)

It would be awesome to be able to specify it globally in SMF though, anywhere you wanted.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Arantor

You can't have both, one or the other, and having 'options' for everything is never, ever the good idea people think it is.

Ninja ZX-10RR

Got to file a bug report for this one... I am surprised that nobody did before O.o
When you install this mod the suggest.js file providing a dropdown list of possible moderators doesn't work anymore. I have been told by a very experienced guy that instead of assigning the function to window.onload directly in the js file, you should be using addLoadEvent and that would cure it.
I tried uninstalling it and the problem went away indeed, also I tried to install it on a clean forum and the problem was there as soon as I installed this.

Thanks in advance for any help :)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

NanoSector

Thanks - will fix this in a future release.

I'll add links to my Github repos in the mod descriptions while I'm at it. Might help :)
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Advertisement: