Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Acans on September 15, 2010, 08:00:30 AM

Title: [TIP] Lazy Admin Menu
Post by: Acans on September 15, 2010, 08:00:30 AM
I'm quite a lazy person, there for I created a lazy admin menu for all my forums.

Everything is done in subs.php, no need to add anything to modifications.english.php because it gets everything it needs from admin.english.php. This also means it'll work with other languages packs installed. All tabs have the correct permissions, if you don't have to permission to edit boards, it won't show. If you have permissions to maintenance area and reports aren't enabled it'll still show the tab, just won't take you anywhere.

Code (Find:) Select
// Set up the menu privileges.

Code (Add Before:) Select
// Load the Lazy Admin Menu Language Strings...
loadLanguage('Admin');


Code (Find:) Select
'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,
),
),
),


Code (Replace:) Select
'admin' => array(
'title' => $txt['admin'],
'href' => $scripturl . '?action=admin',
'show' => $context['allow_admin'],
'sub_buttons' => array(
'index' => array(
'title' => $txt['admin_main'],
'show' => $context['allow_admin'],
'sub_buttons' => array(
'admincentre' => array(
'title' => $txt['admin_center'],
'href' => $scripturl . '?action=admin;area=index',
'show' => $context['allow_admin'],
),
'credits' => array(
'title' => $txt['support_credits_title'],
'href' => $scripturl . '?action=admin;area=credits',
'show' => $context['allow_admin'],
),
'news' => array(
'title' => $txt['news_title'],
'href' => $scripturl . '?action=admin;area=news',
'show' => allowedTo('edit_news', 'send_mail', 'admin_forum'),
),
'packages' => array(
'title' => $txt['package'],
'href' => $scripturl . '?action=admin;area=packages',
'show' => allowedTo('admin_forum'),
),
),
),
'config' => array(
'title' => $txt['admin_config'],
'show' => allowedTo('admin_forum'),
'sub_buttons' => array(
'corefeatures' => array(
'title' => $txt['core_settings_title'],
'href' => $scripturl . '?action=admin;area=corefeatures',
'show' => allowedTo('admin_forum'),
),
'featuresettings' => array(
'title' => $txt['modSettings_title'],
'href' => $scripturl . '?action=admin;area=featuresettings',
'show' => allowedTo('admin_forum'),
),
'security' => array(
'title' => $txt['admin_security_moderation'],
'href' => $scripturl . '?action=admin;area=securitysettings',
'show' => allowedTo('admin_forum'),
),
'languages' => array(
'title' => $txt['language_configuration'],
'href' => $scripturl . '?action=admin;area=languages',
'show' => allowedTo('admin_forum'),
),
'serversettings' => array(
'title' => $txt['admin_server_settings'],
'href' => $scripturl . '?action=admin;area=serversettings',
'show' => allowedTo('admin_forum'),
),
'current_theme' => array(
'title' => $txt['theme_current_settings'],
'href' => $scripturl . '?action=admin;area=theme;sa=settings',
'show' => allowedTo('admin_forum'),
),
'theme' => array(
'title' => $txt['theme_admin'],
'href' => $scripturl . '?action=admin;area=theme;sa=admin',
'show' => allowedTo('admin_forum'),
),
'modsettings' => array(
'title' => $txt['admin_modifications'],
'href' => $scripturl . '?action=admin;area=modsettings',
'show' => allowedTo('admin_forum'),
),
),
),
'forum' => array(
'title' => $txt['layout_controls'],
'show' => allowedTo(array('manage_boards', 'admin_forum', 'manage_smileys', 'manage_attachments', 'moderate_forum')),
'sub_buttons' => array(
'boards' => array(
'title' => $txt['admin_boards'],
'href' => $scripturl . '?action=admin;area=manageboards',
'show' => allowedTo('manage_boards'),
),
'postssettings' => array(
'title' => $txt['manageposts'],
'href' => $scripturl . '?action=admin;area=postsettings',
'show' => allowedTo(array('admin_forum', 'moderate_forum')),
),
'calendar' => array(
'title' => $txt['manage_calendar'],
'href' => $scripturl . '?action=admin;area=managecalander',
'show' => allowedTo('admin_forum'),
),
'search' => array(
'title' => $txt['manage_search'],
'href' => $scripturl . '?action=admin;area=managesearch',
'show' => allowedTo('admin_forum'),
),
'smileys' => array(
'title' => $txt['smileys_manage'],
'href' => $scripturl . '?action=admin;area=smileys',
'show' => allowedTo('manage_smileys'),
),
'attachments' => array(
'title' => $txt['attachments_avatars'],
'href' => $scripturl . '?action=admin;area=manageattachements',
'show' => allowedTo('manage_attachments'),
),
),
),
'member' => array(
'title' => $txt['admin_manage_members'],
'show' => allowedTo(array('moderate_forum', 'manage_membergroups', 'manage_bans', 'manage_permissions', 'admin_forum')),
'sub_buttons' => array(
'members' => array(
'title' => $txt['admin_users'],
'href' => $scripturl . '?action=admin;area=viewmembers',
'show' => allowedTo('moderate_forum'),
),
'membergroup' => array(
'title' => $txt['admin_groups'],
'href' => $scripturl . '?action=admin;area=membergroups',
'show' => allowedTo('manage_membergroups'),
),
'permissions' => array(
'title' => $txt['edit_permissions'],
'href' => $scripturl . '?action=admin;area=permissions',
'show' => allowedTo('manage_permissions'),
),
'registration' => array(
'title' => $txt['registration_center'],
'href' => $scripturl . '?action=admin;area=regcenter',
'show' => allowedTo(array('admin_forum', 'moderate_forum')),
),
'banlist' => array(
'title' => $txt['ban_title'],
'href' => $scripturl . '?action=admin;area=ban',
'show' => allowedTo('manage_attachments'),
),
'paidsubscriptions' => array(
'title' => $txt['paid_subscriptions'],
'href' => $scripturl . '?action=admin;area=paidsubscribe',
'show' => allowedTo('admin_forum'),
),
'search_engines' => array(
'title' => $txt['search_engines'],
'href' => $scripturl . '?action=admin;area=sengines',
'show' => allowedTo('admin_forum'),
),
),
),
'maintenance' => array(
'title' => $txt['admin_maintenance'],
'show' => allowedTo('admin_forum'),
'sub_buttons' => array(
'forum_maintenance' => array(
'title' => $txt['maintain_title'],
'href' => $scripturl . '?action=admin;area=maintain',
'show' => allowedTo('admin_forum'),
),
'schedualed' => array(
'title' => $txt['maintain_tasks'],
'href' => $scripturl . '?action=admin;area=scheduledtasks',
'show' => allowedTo('admin_forum'),
),
'mail' => array(
'title' => $txt['mailqueue_title'],
'href' => $scripturl . '?action=admin;area=mailqueue',
'show' => allowedTo('admin_forum'),
),
'reports' => array(
'title' => $txt['generate_reports'],
'href' => $scripturl . '?action=admin;area=reports',
'show' => allowedTo('admin_forum'),
),
'logs' => array(
'title' => $txt['logs'],
'href' => $scripturl . '?action=admin;area=logs',
'show' => allowedTo('admin_forum'),
),
),
),
),
),





Got Simple Portal? No Problem ;)

Code (Find:) Select
// Load the Lazy Admin Menu Language Strings...
loadLanguage('Admin');


Code (Add After:) Select
loadLanguage('SPortalAdmin');

Code (Find:) Select
'attachments' => array(
'title' => $txt['attachments_avatars'],
'href' => $scripturl . '?action=admin;area=manageattachements',
'show' => allowedTo('manage_attachments'),
),
),
),


Code (Add After:) Select
'portal' => array(
'title' => $txt['sp-adminCatTitle'],
'show' => allowedTo(array('sp_admin', 'sp_manage_settings', 'sp_manage_blocks', 'sp_manage_articles', 'sp_manage_pages', 'sp_manage_shoutbox')),
'sub_buttons' => array(
'portalconfig' => array(
'title' => $txt['sp-adminConfiguration'],
'href' => $scripturl . '?action=admin;area=portalconfig',
'show' => allowedTo(array('sp_admin', 'sp_manage_settings')),
),
'portalblocks' => array(
'title' => $txt['sp-blocksBlocks'],
'href' => $scripturl . '?action=admin;area=portalblocks',
'show' => allowedTo(array('sp_admin', 'sp_manage_blocks')),
),
'portalarticles' => array(
'title' => $txt['sp-adminColumnArticles'],
'href' => $scripturl . '?action=admin;area=portalarticles',
'show' => allowedTo(array('sp_admin', 'sp_manage_articles')),
),
'portalpages' => array(
'title' => $txt['sp_admin_pages_title'],
'href' => $scripturl . '?action=admin;area=portalpages',
'show' => allowedTo(array('sp_admin', 'sp_manage_pages')),
),
'portalshoutbox' => array(
'title' => $txt['sp_admin_shoutbox_title'],
'href' => $scripturl . '?action=admin;area=portalshoutbox',
'show' => allowedTo(array('sp_admin', 'sp_manage_shoutbox')),
),
),
),


Credits to Labradoodle-360 showing me how to load language strings.
Title: Re: [TIP] Lazy Admin Menu
Post by: Hj Ahmad Rasyid Hj Ismail on September 15, 2010, 08:11:47 AM
Nice tips. Thanks. I have been looking for a way to organize my admin menu. Currently I used cms mod to manage my forum menu. May be this can be packaged as that too. And with admin custom page that have the link and button to manage all settings (like cpanel or so). Hmm... Nice, nice indeed.

EDITED: CMS Mod is no longer available from SMF Mod site/ page.
Title: Re: [TIP] Lazy Admin Menu
Post by: Acans on September 15, 2010, 08:22:15 AM
I'm no mod developer or programmer. I couldn't even get it to hide tabs like reports if the feature isn't enabled, even with IchBin™ trying to explain it to me lol.
Title: Re: [TIP] Lazy Admin Menu
Post by: Antechinus on September 15, 2010, 04:59:46 PM
Cool. I do something similar but don't take it that far as I just want the areas I use regularly. Anyone can alter it to suit themselves though. I'll move this to Tips and Tricks. :)
Title: Re: [TIP] Lazy Admin Menu
Post by: Acans on September 15, 2010, 11:04:27 PM
Exactly, it takes less than a minute to remove the tabs and category's you do not want.
Title: Re: [TIP] Lazy Admin Menu
Post by: Hj Ahmad Rasyid Hj Ismail on September 16, 2010, 04:25:56 AM
I for got to ask, is this for SMF 2.0 RCx or 1.1.x?
Title: Re: [TIP] Lazy Admin Menu
Post by: Antechinus on September 16, 2010, 04:46:03 AM
Try loading a 1.1.x menu from an array like that and see how far you get. ;)
Title: Re: [TIP] Lazy Admin Menu
Post by: Hj Ahmad Rasyid Hj Ismail on September 16, 2010, 05:47:36 AM
Quote from: Antechinus on September 16, 2010, 04:46:03 AM
Try loading a 1.1.x menu from an array like that and see how far you get. ;)
So, it's basically 2.0 RCx. He he he...  :D
Title: Re: [TIP] Lazy Admin Menu
Post by: Joker™ on September 16, 2010, 08:32:36 AM
Nice tip , will make admins like me more lazy :P
Title: Re: [TIP] Lazy Admin Menu
Post by: Acans on September 16, 2010, 08:56:40 AM
Added Simpleportal if anybody wants it.
Title: Re: [TIP] Lazy Admin Menu
Post by: Norv on September 16, 2010, 03:48:43 PM
Oh my kind of tip: promoting lazyness!

Thanks acans :)
Title: Re: [TIP] Lazy Admin Menu
Post by: Robert. on September 17, 2010, 01:18:42 AM
Very nice! :D But you stole my modification idea. :( No, just joking. :P Very good job! :D
Title: Re: [TIP] Lazy Admin Menu
Post by: kat on July 21, 2014, 08:29:27 AM
Dunno how I missed this, for so long...

It's brilliant! Ta, ѕησω!
Title: Re: [TIP] Lazy Admin Menu
Post by: jamiewalters68 on July 21, 2014, 07:16:14 PM
Pretty laid out actually! I've just started emerging myself into forums. Well, I do hope I'll be able to manage my forums a little easier through this. Thanks!
Title: Re: [TIP] Lazy Admin Menu
Post by: Hj Ahmad Rasyid Hj Ismail on July 21, 2014, 07:30:44 PM
Now it is already made a mod K@. Lazy admin can be even lazier when using a packaged mod. Ha ha ha...
Title: Re: [TIP] Lazy Admin Menu
Post by: kat on July 22, 2014, 05:25:32 AM
Heh... As it happens, I think the menus should be like that, as standard. :)
Title: Re: [TIP] Lazy Admin Menu
Post by: Ninja ZX-10RR on July 22, 2014, 05:37:14 PM
As a footnote, it's this one --> http://www.simplemachines.org/community/index.php?topic=525466.0 taken from ѕησω and published by DougieFresh :D
Title: Re: [TIP] Lazy Admin Menu
Post by: Hj Ahmad Rasyid Hj Ismail on July 22, 2014, 07:10:00 PM
Hahaha... And now it being discussed by our captain there. Interesting...
Title: Re: [TIP] Lazy Admin Menu
Post by: kayeshandra85 on July 25, 2014, 08:27:27 PM
Just what I was looking for ;) I better try this. I'll just update you how it works on my end. Thanks!
Title: Re: [TIP] Lazy Admin Menu
Post by: Hj Ahmad Rasyid Hj Ismail on July 26, 2014, 01:01:51 AM
There is already a packaged mod for this. But of course you can manually do it.
Title: Re: [TIP] Lazy Admin Menu
Post by: kat on July 26, 2014, 04:30:55 AM
/me wonders how much of a pain it'd be, to extend this to include the "Profile" menu...
Title: Re: [TIP] Lazy Admin Menu
Post by: NanoSector on July 26, 2014, 04:47:29 AM
Quote from: ahrasis on July 26, 2014, 01:01:51 AM
There is already a packaged mod for this. But of course you can manually do it.
Why take the easy route when you can do it the hard way. ;)
Title: Re: [TIP] Lazy Admin Menu
Post by: Steve on July 26, 2014, 09:49:25 AM
@ K@ ... that would be nice wouldn't it?

Lol @ NanoSector
Title: Re: [TIP] Lazy Admin Menu
Post by: Arantor on July 26, 2014, 10:06:49 AM
The answer is ugliness, it's why when I redid the profile menu in 2.1, I deliberately *didn't* do it the same way, especially since while it's not too bad in performance doing the admin menu due to a lack of people doing the admin menu thing, it's significantly more serious for the profile menu.
Title: Re: [TIP] Lazy Admin Menu
Post by: kat on July 26, 2014, 10:27:53 AM
Shame...
Title: Re: [TIP] Lazy Admin Menu
Post by: Arantor on July 26, 2014, 10:28:13 AM
Did you see what I did in 2.1 though? It's almost as good IMNSHO.
Title: Re: [TIP] Lazy Admin Menu
Post by: kat on July 26, 2014, 10:32:35 AM
Not yet. I have yummy access to young Rick's site, though. I'll have a butcher's.
Title: Re: [TIP] Lazy Admin Menu
Post by: Arantor on July 26, 2014, 10:33:06 AM
The profile menu is now at the top, along with messages and notifications.
Title: Re: [TIP] Lazy Admin Menu
Post by: kat on July 26, 2014, 10:35:51 AM
Oh, yeah! I forgot how to get to the profile, at first... :P

MUCH better. :)
Title: Re: [TIP] Lazy Admin Menu
Post by: Arantor on July 26, 2014, 10:37:34 AM
I thought so. There were people who didn't approve of the way I implemented it because loading all the profile menu every page rather than doing a call to the server to get it was obviously terrible.
Title: Re: [TIP] Lazy Admin Menu
Post by: kat on July 26, 2014, 10:51:33 AM
Well, it works. It seems to work quickly, on Rick's site, and it's infinitely better'n what's in 2.0.x.

Sooooo...

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.katzy.dsl.pipex.com%2FSmileys%2Fc014.gif&hash=f74820123053ff9301b57a2ded5672bfa96b900b)

'course, being an old fart, I still prefer the old "Icons" approach. But, that's another skirmish. ;)
Title: Re: [TIP] Lazy Admin Menu
Post by: Arantor on July 26, 2014, 10:52:28 AM
I like to think I made several usability improvements in 2.1 even if they ignore consistency.

Improving the admin menu as per this tip (or mod) though is not one of them :/
Title: Re: [TIP] Lazy Admin Menu
Post by: Hj Ahmad Rasyid Hj Ismail on July 26, 2014, 07:08:39 PM
Quote from: ‽ on July 26, 2014, 10:28:13 AM
IMNSHO

Lols...

If you could maybe do the same with lazy admin menu the way you did for profile menu in 2.1? :P

I never check the code in 2.1 though have tested it. I'll wait until it is beta to do the Malay translation and going through the codes. [lazy translator mode] ;)
Title: Re: [TIP] Lazy Admin Menu
Post by: Arantor on July 26, 2014, 07:11:52 PM
You're presuming that I care enough about 2.1 to write any code for it any more.

What I did was set up a special callback in the profile to serve a dedicated template. Doing that for admin would be a mess in 2.1 simply because there's just so much more stuff and the profile popup is only a specific subset of what's in the profile since most of the things you just don't need instant access to.
Title: Re: [TIP] Lazy Admin Menu
Post by: jamiewalters68 on July 26, 2014, 11:42:21 PM
I do hope I could get something great from this since I'm still a newbie. Anyway, thanks!
Title: Re: [TIP] Lazy Admin Menu
Post by: dougiefresh on August 02, 2014, 05:25:18 PM
Quote from: K@ on July 26, 2014, 04:30:55 AM
/me wonders how much of a pain it'd be, to extend this to include the "Profile" menu...
Better Profile Menu (http://custom.simplemachines.org/mods/index.php?mod=3904) was written....  Only it duplicates the menu structure as SMF 2.1 Alpha 1 does it, but not the whole effect.  It's a static menu, but it's like this tip.
Title: Re: [TIP] Lazy Admin Menu
Post by: Steve on August 02, 2014, 06:33:35 PM
And it has a problem still as I posted in that mod's thread. ;)
Title: Re: [TIP] Lazy Admin Menu
Post by: dougiefresh on August 03, 2014, 10:34:24 AM
The problems have been addressed in the other thread.....
Title: Re: [TIP] Lazy Admin Menu
Post by: Steve on August 03, 2014, 11:18:10 AM
And fixed. (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi1262.photobucket.com%2Falbums%2Fii614%2FOPStuph%2FSmilies%2Fthumbs-up.gif&hash=0a269f01d090bee70f928a97ea14bf37388a718e)
Title: Re: [TIP] Lazy Admin Menu
Post by: Arantor on August 03, 2014, 11:19:49 AM
Everyone's a winner :)
Title: Re: [TIP] Lazy Admin Menu
Post by: Hj Ahmad Rasyid Hj Ismail on August 04, 2014, 05:08:11 AM
I just realize that this mod and the packaged mod is different in the sense that the packaged mod is listing the admin menu automatically while this mod is listing the admin menu manually. I am not sure which one is the best though but automatically should cover new menu added by mods as well, right?
Title: Re: [TIP] Lazy Admin Menu
Post by: Arantor on August 04, 2014, 05:09:36 AM
The mod does it better in pretty much every respect since it automatically covers other mods.
Title: Re: [TIP] Lazy Admin Menu
Post by: Hj Ahmad Rasyid Hj Ismail on August 04, 2014, 05:31:39 AM
What about the loading issue? Does that only applies to manual mod or the packaged mod as well?

Quote from: ‽ on July 21, 2014, 01:41:20 PM
Not a fan of loading potentially many extra files every page load for admins.
Title: Re: [TIP] Lazy Admin Menu
Post by: Arantor on August 04, 2014, 05:32:46 AM
The mod handles that by adding caching, which is A Good Thing.
Title: Re: [TIP] Lazy Admin Menu
Post by: Hj Ahmad Rasyid Hj Ismail on August 04, 2014, 05:59:47 AM
The Better Profile mod doesn't list menu automatically but manually. No caching is added as I can see. Will this cause any loading issue if compared to Lazy Admin Menu mod? (Both were originally based on this mod idea but later extended as I understand).
Title: Re: [TIP] Lazy Admin Menu
Post by: Arantor on August 04, 2014, 06:05:26 AM
No, because in the Better Profile Mod's case it doesn't dynamically load anything which is where the performance headache is. If you have a static list the cost is negligible. But the minute it's loaded on demand, you escalate the cost to cover loading all the files in question - don't forget that Admin.php (where the Admin menu is stored) is so much more than just the admin menu.

Same with profile but trying to splice the profile menu is... a joy I wouldn't even begin to recommend to anyone.

One thing I will say that is quietly annoying me about this... instead of putting in effort backporting 2.1 stuff to 2.0, I'd honestly prefer to see the time and energy being spent on getting 2.1 ready.
Title: Re: [TIP] Lazy Admin Menu
Post by: Hj Ahmad Rasyid Hj Ismail on August 04, 2014, 06:13:36 AM
Thank you for the explanation.

Agreed on the last paragraph as well.
Title: Re: [TIP] Lazy Admin Menu
Post by: dougiefresh on August 04, 2014, 07:08:31 AM
Quote from: ‽ on August 04, 2014, 06:05:26 AM
One thing I will say that is quietly annoying me about this... instead of putting in effort backporting 2.1 stuff to 2.0, I'd honestly prefer to see the time and energy being spent on getting 2.1 ready.
Like you've pointed out, it's the "joy" of modding.  Mod authors can focus on what they want to focus on.....  Although I admit, I don't understand how to "search" for issues within 2.1 to test....  And yes, I've read the How can I help? (http://www.simplemachines.org/community/index.php?topic=523428.0) topic in the 2.1 section....
Title: Re: [TIP] Lazy Admin Menu
Post by: Arantor on August 04, 2014, 07:20:24 AM
I do understand, but at the same time it seems like energy that might better be served elsewhere. My refusal to contribute seriously to 2.1 any longer is not technical but mostly political.

As far as testing, everything needs testing. Every facet of every function needs testing. There are entire functions that have never been tested, not even by their authors. It also needs usability testing by people who, well, aren't the core team to see where there are stupid things that can be changed to improve usability.

Testing at the code level is borderline impossible, despite every attempt I made to clean up unnecessary options and reduce path complexity.
Title: Re: [TIP] Lazy Admin Menu
Post by: dougiefresh on August 04, 2014, 07:49:03 AM
Okay, okay.... Lemme finish up the last two mods that I had submitted like a year ago and never got around to fixing properly so that they would get approved....  (As well as the bug reports  :o )  and I'll look at 2.1 further...