Hiding Certain Admin Areas For Mods

Started by Stanyy, August 28, 2014, 02:21:50 PM

Previous topic - Next topic

Stanyy

I would like to hide the Admin Center (front) for global moderators who can access the admin area. Sure they can see areas they have permission to access but I want to hide the main admin homepage (if I can call it that).
Is it ok if I just put a condition around the function template_admin() code in the admin template?

Arantor

No, because it'll break if the function isn't declared.

What's the problem with showing the front page? The areas that aren't visible won't be shown to them anyway. If it's any consolation, you could install the mod that revamps the admin panel to be like 2.1's a bit more, whereby the chunk of stuff at the bottom won't be visible to them and instead there will be icons showing off what's available.

The only practical concern with showing the admin area but not the items available is if your forum isn't up to date.

Sir Osis of Liver

If you condition out the function, you'll get an error. You can place an if statement inside the first curly bracket, above the global statement, and bracket everything below that to the closing bracket of the function.  Mods will see just the header, menu buttons, linktree, and footer.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Stanyy

Quote from: Krash on August 28, 2014, 02:35:37 PM
If you condition out the function, you'll get an error. You can place an if statement inside the first curly bracket, above the global statement, and bracket everything below that to the closing bracket of the function.  Mods will see just the header, menu buttons, linktree, and footer.

When I did it using if ($context['user']['is_admin']), it also hides the area for me (the admin). :(

@Arantor, what's the name of the mod. Thanks.

Arantor

http://custom.simplemachines.org/mods/index.php?mod=3907

It still shows the admin news and list of admins but I can't imagine why that would actually be a problem...

I am curious: what exactly are you trying to hide from your non-administrators?

Stanyy

Quote from: ♥ on August 28, 2014, 03:07:13 PM
http://custom.simplemachines.org/mods/index.php?mod=3907

It still shows the admin news and list of admins but I can't imagine why that would actually be a problem...

I am curious: what exactly are you trying to hide from your non-administrators?
The entire section. I think it's unnecessary (especially to mods), I wish I could hide the submenu button too, but that's controlled by GenericMenu :( ...... I've been trying to simplify things in my forum; cut out the unnecessary bits and make it work in a 'straight to the point' kind of way.

Quote from: Krash on August 28, 2014, 02:35:37 PM
If you condition out the function, you'll get an error. You can place an if statement inside the first curly bracket, above the global statement, and bracket everything below that to the closing bracket of the function.  Mods will see just the header, menu buttons, linktree, and footer.

I used it below the global statement and it worked as it should :) I hope that won't cause any problems.

Arantor

Except the whole point of exposing the functionality that way is to make sure they do have access to the things you're giving them access to...

Sir Osis of Liver

Quote from: Stanyy on August 28, 2014, 05:04:43 PM
I used it below the global statement and it worked as it should :) I hope that won't cause any problems.

That should work fine, it's basically an empty function if you're not admin, and does nothing.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Advertisement: