• Welcome to Simple Machines Community Forum. Please login or sign up.
November 29, 2021, 03:09:51 AM

News:

Wondering if this will always be free?  See why free is better.


[TIP] Lazy Admin Menu

Started by ѕησω, September 15, 2010, 08:00:30 AM

Previous topic - Next topic

ѕησω

September 15, 2010, 08:00:30 AM Last Edit: December 26, 2010, 06:06:54 AM by ѕησω
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.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not dead yet, the time was soon to come to pass when mysql_query shall be gone and no more."

Hj Ahmad Rasyid Hj Ismail

September 15, 2010, 08:11:47 AM #1 Last Edit: September 16, 2010, 09:18:41 AM by ahrasis
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.

ѕησω

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.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not dead yet, the time was soon to come to pass when mysql_query shall be gone and no more."

Antechinus

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. :)

ѕησω

Exactly, it takes less than a minute to remove the tabs and category's you do not want.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not dead yet, the time was soon to come to pass when mysql_query shall be gone and no more."

Hj Ahmad Rasyid Hj Ismail

I for got to ask, is this for SMF 2.0 RCx or 1.1.x?

Antechinus

Try loading a 1.1.x menu from an array like that and see how far you get. ;)

Hj Ahmad Rasyid Hj Ismail

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

Joker™

Nice tip , will make admins like me more lazy :P
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

ѕησω

Added Simpleportal if anybody wants it.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not dead yet, the time was soon to come to pass when mysql_query shall be gone and no more."

Norv

Oh my kind of tip: promoting lazyness!

Thanks acans :)
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Robert.

Very nice! :D But you stole my modification idea. :( No, just joking. :P Very good job! :D

kat

Dunno how I missed this, for so long...

It's brilliant! Ta, ѕησω!

jamiewalters68

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!

Hj Ahmad Rasyid Hj Ismail

Now it is already made a mod K@. Lazy admin can be even lazier when using a packaged mod. Ha ha ha...

kat

Heh... As it happens, I think the menus should be like that, as standard. :)

Ninja ZX-10RR

As a footnote, it's this one --> http://www.simplemachines.org/community/index.php?topic=525466.0 taken from ѕησω and published by DougieFresh :D
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

Hj Ahmad Rasyid Hj Ismail

Hahaha... And now it being discussed by our captain there. Interesting...

kayeshandra85

Just what I was looking for ;) I better try this. I'll just update you how it works on my end. Thanks!

Hj Ahmad Rasyid Hj Ismail

There is already a packaged mod for this. But of course you can manually do it.

Advertisement: