News:

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

Main Menu

Menu is getting out of control....how to move things in submenus?

Started by shadav, June 29, 2020, 11:57:19 AM

Previous topic - Next topic

shadav

So my menu is getting a bit out of control

how can move things around into more submenus

Like I don't know maybe make a menu called My Links and move the profile and pm into it

And a (not sure what to name it) menu and move the member list, buddy page, and staff list into it

and maybe a staff menu and move the moderator and admin menu to it

I'm assuming in the subs.php

everything that I try I keep getting HTTP ERROR 500

Deaks

Have you looked at the Menu Editor mods?

Also you need to alter the subs.php to do this manually, if you post your subs.php we can help better.
~~~~
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."

Sir Osis of Liver

Take one of the existing menus with submenus from the buttons array and substitute whatever you wany in it.  Use unique names for each array.



'moderate' => array(
'title' => $txt['moderate'],
'href' => $scripturl . '?action=moderate',
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'modlog' => array(
'title' => $txt['modlog_view'],
'href' => $scripturl . '?action=moderate;area=modlog',
'show' => !empty($modSettings['modlog_enabled']) && !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'poststopics' => array(
'title' => $txt['mc_unapproved_poststopics'],
'href' => $scripturl . '?action=moderate;area=postmod;sa=posts',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'attachments' => array(
'title' => $txt['mc_unapproved_attachments'],
'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'reports' => array(
'title' => $txt['mc_reported_posts'],
'href' => $scripturl . '?action=moderate;area=reports',
'show' => !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
'is_last' => true,
),
),
),

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

                                     - R. Waters

shadav

Quote from: Deaks on June 29, 2020, 12:00:01 PM
Have you looked at the Menu Editor mods?

Also you need to alter the subs.php to do this manually, if you post your subs.php we can help better.

nothing i've found in the mod list does this....there's mods to add menu items, rearrange menu items....but not to move them into submenus and such


so for instance in my subs.php the admin and moderator
'admin' => array(
'title' => $txt['admin'],
'href' => $scripturl . '?action=admin',
'show' => $context['allow_admin'],
'sub_buttons' => array(
'featuresettings' => array(
'title' => $txt['modSettings_title'],
'href' => $scripturl . '?action=admin;area=featuresettings',
'show' => allowedTo('admin_forum'),
),
'packages' => array(
'title' => $txt['package'],
'href' => $scripturl . '?action=admin;area=packages',
'show' => allowedTo('admin_forum'),
),
'errorlog' => array(
'title' => $txt['errlog'],
'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc',
'show' => allowedTo('admin_forum') && !empty($modSettings['enableErrorLogging']),
),
'permissions' => array(
'title' => $txt['edit_permissions'],
'href' => $scripturl . '?action=admin;area=permissions',
'show' => allowedTo('manage_permissions'),
'is_last' => true,
),
),
),
'moderate' => array(
'title' => $txt['moderate'],
'href' => $scripturl . '?action=moderate',
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'modlog' => array(
'title' => $txt['modlog_view'],
'href' => $scripturl . '?action=moderate;area=modlog',
'show' => !empty($modSettings['modlog_enabled']) && !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'poststopics' => array(
'title' => $txt['mc_unapproved_poststopics'],
'href' => $scripturl . '?action=moderate;area=postmod;sa=posts',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'attachments' => array(
'title' => $txt['mc_unapproved_attachments'],
'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'reports' => array(
'title' => $txt['mc_reported_posts'],
'href' => $scripturl . '?action=moderate;area=reports',
'show' => !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
'is_last' => true,
),
),
),

instead of these being separate menu items, i'd like them to be one menu item and 2 submenus (with their own submenus)

these gives 500 error

'stafflinks' => array(
'title' => Staff Links,
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'admin' => array(
'title' => $txt['admin'],
'href' => $scripturl . '?action=admin',
'show' => $context['allow_admin'],
'sub_buttons' => array(
'featuresettings' => array(
'title' => $txt['modSettings_title'],
'href' => $scripturl . '?action=admin;area=featuresettings',
'show' => allowedTo('admin_forum'),
),
'packages' => array(
'title' => $txt['package'],
'href' => $scripturl . '?action=admin;area=packages',
'show' => allowedTo('admin_forum'),
),
'errorlog' => array(
'title' => $txt['errlog'],
'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc',
'show' => allowedTo('admin_forum') && !empty($modSettings['enableErrorLogging']),
),
'permissions' => array(
'title' => $txt['edit_permissions'],
'href' => $scripturl . '?action=admin;area=permissions',
'show' => allowedTo('manage_permissions'),
'is_last' => true,
),
),
),
'moderate' => array(
'title' => $txt['moderate'],
'href' => $scripturl . '?action=moderate',
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'modlog' => array(
'title' => $txt['modlog_view'],
'href' => $scripturl . '?action=moderate;area=modlog',
'show' => !empty($modSettings['modlog_enabled']) && !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'poststopics' => array(
'title' => $txt['mc_unapproved_poststopics'],
'href' => $scripturl . '?action=moderate;area=postmod;sa=posts',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'attachments' => array(
'title' => $txt['mc_unapproved_attachments'],
'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'reports' => array(
'title' => $txt['mc_reported_posts'],
'href' => $scripturl . '?action=moderate;area=reports',
'show' => !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
'is_last' => true,
),
),
),
),
),
),



'stafflinks' => array(
'title' => Staff Links,
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'admin' => array(
'title' => $txt['admin'],
'href' => $scripturl . '?action=admin',
'show' => $context['allow_admin'],
'sub_buttons' => array(
'featuresettings' => array(
'title' => $txt['modSettings_title'],
'href' => $scripturl . '?action=admin;area=featuresettings',
'show' => allowedTo('admin_forum'),
),
'packages' => array(
'title' => $txt['package'],
'href' => $scripturl . '?action=admin;area=packages',
'show' => allowedTo('admin_forum'),
),
'errorlog' => array(
'title' => $txt['errlog'],
'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc',
'show' => allowedTo('admin_forum') && !empty($modSettings['enableErrorLogging']),
),
'permissions' => array(
'title' => $txt['edit_permissions'],
'href' => $scripturl . '?action=admin;area=permissions',
'show' => allowedTo('manage_permissions'),
'is_last' => true,
),
),
'moderate' => array(
'title' => $txt['moderate'],
'href' => $scripturl . '?action=moderate',
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'modlog' => array(
'title' => $txt['modlog_view'],
'href' => $scripturl . '?action=moderate;area=modlog',
'show' => !empty($modSettings['modlog_enabled']) && !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'poststopics' => array(
'title' => $txt['mc_unapproved_poststopics'],
'href' => $scripturl . '?action=moderate;area=postmod;sa=posts',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'attachments' => array(
'title' => $txt['mc_unapproved_attachments'],
'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'reports' => array(
'title' => $txt['mc_reported_posts'],
'href' => $scripturl . '?action=moderate;area=reports',
'show' => !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
'is_last' => true,
),
),
),
),
),


Sir Osis of Liver



'title' => Staff Links,



That's a 500 error.



'title' => 'Staff Links',


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

                                     - R. Waters

shadav

Quote from: Sir Osis of Liver on June 29, 2020, 12:45:53 PM


'title' => Staff Links,



That's a 500 error.



'title' => 'Staff Links',



thanks for the correction, but still gives 500 error

Sir Osis of Liver

It's in the 'moderate' array but can't find it, and gotta go.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Antechinus

Post your Subs.php up so we can take a look at the whole kaboodle. :)

shadav


Antechinus


shadav

well that half way worked.... no 500 error but also no submenu for the admin or moderator menus.....

Antechinus

That looks weird. It shouldn't display the button title twice if it's only defined once in the array. Is that running the exact file I attached?

Antechinus

Ok, just tried code straight from the file I attached, on my test site. Works perfectly. :D

What have you done to my nice shiny code?

Sir Osis of Liver

I'm back.  Try this.  Make sure you've removed the original admin and moderate arrays.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

shadav

bwahahaha Iz dids nuffin

erm it's probably either the alternative menu mod thingie or the working top level for drop down links mod

my menu's just does that  :laugh:
on a drop down, the first listing is the original menu for some strange reason....

shadav

Quote from: Sir Osis of Liver on June 29, 2020, 09:50:56 PM
I'm back.  Try this.  Make sure you've removed the original admin and moderate arrays.

unfortunately same issue, no submenus for admin/mod
and apparently the rest of my menus disappeared....

Sir Osis of Liver

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

                                     - R. Waters

Antechinus

Yup. Kill mods first (I noticed you weren't using their stuff for actual buttons yet). See if nice shiny code works without mods in the way (I know it does). Can proceed from there, if you still want menu mods (may require body armour and pointy sticks).

Antechinus

Did you end up getting this to work? It's all just bog standard button arrays, so it should work. In fact it should be easy.

Was thinking about the mods too. Really, as long as they don't bork the standard menu buttons they shouldn't bork this custom one either. The only reason they might (or should) is if you were trying to use the same array name for two different buttons. An example would be if you left the default admin button while trying to throw in this custom one too.

'sub_buttons' => array(
'admin' => array(


You can use 'sub_buttons' => array( as often as you like, but you can only use 'admin' => array( once in the whole menu.

Mick.

There are other buttons like the 'help' button and from other mods that add buttons to the menu that you can set it from show=> true to false. It alleviates the menu mumble jumble. You can still use these buttons on a side block if you wish. Help, Search, Calendar, Members

Subs.php near the bottom. 3/4 of the way

shadav

sorry just getting back to this...it didn't work on the other site, and too lazy to remove all the menu mods installed :p

but tried this on another site without any menu mods installed and got it working (a lot of trial and error on some parts)

thank you for the help :)

Quote from: Mick. on July 01, 2020, 06:06:27 PM
There are other buttons like the 'help' button and from other mods that add buttons to the menu that you can set it from show=> true to false. It alleviates the menu mumble jumble. You can still use these buttons on a side block if you wish. Help, Search, Calendar, Members

Subs.php near the bottom. 3/4 of the way
how can I set up a side block? I don't use portals, don't much care for the looks....but a block on the right side for some menu options might be nice...

now I just need to get my brain functioning to come up with "cute" menu titles to organize things into
right now I've managed to get
a staff link which has the admin and moderator links in it
a market place which has the classifieds and auctions links in it
a user menu which has the profile, pm and logout links in it

now to figure out what to do with
help, calendar, search and directory links

debating to get rid of the search link since there is a search bar in the header

er just ran into a problem
moving the logout into the user menu breaks it....if I try to log out I get
Session verification failed. Please try logging out and back in again, and then try again.

Antechinus

Quoteer just ran into a problem
moving the logout into the user menu breaks it....if I try to log out I get
Session verification failed. Please try logging out and back in again, and then try again.
Javascript problem, perhaps? The logging stuff requires javascript to work properly, so if you moved the button but haven;t called the js in the right place you'd get an error.

shadav

well i have no idea then  :P :laugh:
wouldn't the javascript still apply?
All I'm doing is moving it in the menu to a submenu
(hm ok, that may be the issue....now to figure out how to fix that)

Advertisement: