Working top level links for drop menus

Started by Antechinus, July 01, 2014, 02:31:09 PM

Previous topic - Next topic

Antechinus

Link to Mod

This mod fixes a minor annoyance in the default admin/profile/pm drop menu system, namely the lack of functioning links on the top level tabs.

Installing this mod turns the top level tabs for the admin/profile/PM areas into normal, functioning tabs, just like on the main menu.

This is just a backport of the code that is used in SMF 2.1.


This mod is licensed under the WTFPL.

If the possibility of seeing profanity means you would prefer to not read the actual license terms, rest assured that you can do whatever you like with this mod's code.

January 09, 2015: Minor bug fix. Thanks to ♦ Ninja ZX-10RR ♦

kat

Does exactly what it says, on the tin.

Nice one, Ant! :)

Steve

Took me a little while to see what you meant. So when you click the top level tab, it takes you to the first choice in the dropdown, right?
DO NOT pm me for support!

Antechinus

Yup. It's not a huge deal, but it's just one of those things that bugs people sometimes. People expect buttons to do something. I have no idea why it was decided to make them duds in 2.0.x, since to my way of thinking it makes no more sense than doing the same on the main menu. Hey ho.


Steve

DO NOT pm me for support!

Ninja ZX-10RR

I had never noticed that slight bug but anyway thank you for the fix :D I love the license XD
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

Ninja ZX-10RR

#7
This mod can occasionally lead to undefined indexes or invalid arguments for foreach().
Errors such as these:
Quote
Type of error: General
http://vige.altervista.org/forum/index.php?action=profile;u=46
2: Invalid argument supplied for foreach()
File: /Sources/Subs-Menu.php
Line: 237

QuoteType of error: Undefined
http://vige.altervista.org/forum/index.php?action=profile;u=46
8: Undefined index: sections
File: /Sources/Subs-Menu.php
Line: 237

In Subs-Menu the code is foreach ($menu_context['sections'] as $section_id => $section)
{
foreach ($section['areas'] as $area_id => $area)
{
if (!isset($menu_context['sections'][$section_id]['url']))
{
$menu_context['sections'][$section_id]['url'] = isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $area_id;
break;
}
}
}

Should have been if (!empty($menu_context['sections']))
{
foreach ($menu_context['sections'] as $section_id => $section)
{
foreach ($section['areas'] as $area_id => $area)
{
if (!isset($menu_context['sections'][$section_id]['url']))
{
$menu_context['sections'][$section_id]['url'] = isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $area_id;
break;
}
}
}
}


Credits to a former dev for this one, he refrains from posting (and I kinda understand him, pretty much), but since you have been very kind to me in the past Ant I would like to help you out if I get the chance, and now I have one :) cheers!
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

Antechinus

Aha. Good catch. I'll update the package tonight.

Antechinus

#9
Well that was slack. I just got around to applying the bug fix. I blame Christmas. :D

ETA: Good thing I tried this out too. It alerted me to a bug in the theme I'm working on (wasn't compatible with this mod, but is now).

Advertisement: