News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Disable dropdown menus

Started by Kat9119, July 04, 2012, 11:36:28 AM

Previous topic - Next topic

Kat9119

I'm using the Core theme, and I'm curious if I can disable the ability for users to choose a sidebar or dropdown menu. I don't want them to be able to choose dropdown menus at all. I only see this option in my own profile's look & layout.

Arantor

There's no option anywhere to do this, so it's a code change and last time I tried to do this myself I got into a right mess with it >_>
Holder of controversial views, all of which my own.


Antechinus

Wouldn't it be simple enough to just hide the toggle image and remove the option from the select in Profile, while still leaving all the back end crap alone? Not the most elegant solution, but workable for one site.

Arantor

You'd also have to modify the database for anyone who set the preference, also.

Interestingly enough users would even then still be able to change it by visiting the right link (but practically, that's no big deal)

One thing I would note is that the only place on a normal installation where a normal user should be able to see it is in the profile area anyway.
Holder of controversial views, all of which my own.


Antechinus

Yup, but you could reset the db by using admin options IIRC, without having to run a query manually.

Mnd you, I'm not sure why anyone would want to disable the drop menus. Some people like them. Anyone who doesn't can use the sidebars.

Kat9119

Quote from: Antechinus on July 04, 2012, 05:27:48 PM
Yup, but you could reset the db by using admin options IIRC, without having to run a query manually.

Mnd you, I'm not sure why anyone would want to disable the drop menus. Some people like them. Anyone who doesn't can use the sidebars.

Honestly I think it makes my site look ugly lol. I designed it the way I liked it, then realized that people could choose that if they saw the option to. I think I have the default set so that they have side menus.

Antechinus

Ok, to ditch the toggle find this in GenericMenu.template.php:

// For every section that appears on the sidebar...
$firstSection = true;
foreach ($menu_context['sections'] as $section)
{
// Show the section header - and pump up the line spacing for readability.
echo '
<div class="adm_section">
<div class="cat_bar">
<h4 class="catbg">';

if ($firstSection && !empty($menu_context['can_toggle_drop_down']))
{
echo '
<span class="ie6_header floatleft">
<a href="', $menu_context['toggle_url'], '">', $section['title'],'<img style="margin: 0 5px; vertical-align: middle;" src="', $context['menu_image_path'], '/change_menu', $context['right_to_left'] ? '' : '2', '.png" alt="!" /></a>
</span>';
}
else
{
echo '
', $section['title'];
}

echo '
</h4>
</div>


Change it to this:

// For every section that appears on the sidebar...
$firstSection = true;
foreach ($menu_context['sections'] as $section)
{
// Show the section header - and pump up the line spacing for readability.
echo '
<div class="adm_section">
<div class="cat_bar">
<h4 class="catbg">
', $section['title'], '
</h4>
</div>


To fix teh select in profile, find this here pile of BS in Profile.template.php:

<li>
<input type="hidden" name="default_options[use_sidebar_menu]" value="0" />
<label for="use_sidebar_menu"><input type="checkbox" name="default_options[use_sidebar_menu]" id="use_sidebar_menu" value="1"', !empty($context['member']['options']['use_sidebar_menu']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['use_sidebar_menu'], '</label>
</li>

Change it to this:

<li style="display: none;">
<input type="hidden" name="default_options[use_sidebar_menu]" value="0" />
<label for="use_sidebar_menu"><input type="checkbox" name="default_options[use_sidebar_menu]" id="use_sidebar_menu" value="1" checked="checked" class="input_check" /> ', $txt['use_sidebar_menu'], '</label>
</li>


That should sort it.

You may also be interested in this: Advanced sidebar menus

Arantor

Huh, last time I tried it took way more code than that :/
Holder of controversial views, all of which my own.


Antechinus

Yes but I'm not trying to actually remove anything except the toggle. The rest is just hidden.

Arantor

I wasn't even trying to hide the toggle, I was just trying to force it to always be that way by modifying the menu generator code and IIRC it's still broken, heh.

(Mind you, this was after the code was rewritten to push menus into using the always-shown sidebar we have rather than its own 'sidebar')
Holder of controversial views, all of which my own.


Advertisement: