Option to disable menu for site owner (uid = 1)
smoothify - March 24, 2009 - 19:00
| Project: | SimpleMenu |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Description
I would like the ability to disable simplemenu for the site owner user account.
Since the user with uid of 1 inherits all user_access permissions its not possible to hide it for this user.
I'd like for the site editors to use simple menu, but the site admin to use admin_menu.
Thanks
Ben

#1
Also interested in this. I love admin menu for "admin" stuff... but SimpleMenu is well, much "simpler" for regular users :D
Having SimpleMenu enabled for regular users means the admin (who's may prefer using admin menu) gets a stack of two menus.
I'm sure it would be done differently to expose the option in SimpleMenu's UI, though here's a tweak to simplemenu.module to give the desired result for the time being:
// do a simple access check here, since theme isn't available to check yetglobal $user;
if (user_access('view simplemenu') && $user->uid != '1') {
$global user;was added so that we get access to the user object and see who the current user is... then an extra condition&& $user->uid != '1'is added so that it says "if the user has permission to view simplemenu AND if the user is not uid 1, then proceed".Then to get it to not load SimpleMenu's footer code/javascript in this case:
function simplemenu_footer() {global $user;
if(simplemenu_enabled() && $user->uid != '1') {
Note that I'm not an expert coder and though I think it's fine and my testing showed no negative side effects, use at your own risk.
Hope this helps, and +1 on the feature request :)
#2
This feature would be better maintained if it was able to be switched on and off via the administration page for simple menu.
I will look at rolling a patch for this.
#3
Just did this..
_simplemenu_superuser_active()which tests if$user->uid == 1and ifvariable_get('simplemenu_uid1', 1) == 0.simplemenu_uid1variable.simplemenu_enabled()check tosimplemenu_init()to avoid loading JS and CSS files when not enabled.Quite a simple patch really. I was going to add in role visibility too but then I realised that can be controlled via the permissions system.
#4
Works great!
Thank you very much.
#5
No problem.
I'm with Keyz, I agree that simplemenu is better for certain, shall we say, "less technical" users. ;)
I used to use simplemenu exclusively but have come to like admin_menu so I can now finally say:
simplemenu++
admin_menu++
#6
AWESOME !
#7
I think this still needs to be committed, is that correct?
#8
yes, please! :)