Remove Lazyest Gallery Admin Menu For All But Administrators

This page is in the Code Graveyard where I lay to rest snippets of code that I don't use anymore. Some have lost their usefulness due to the evolving nature of the web, while others have been replaced with better code. "Be Ye Warned!"

PURPOSE: Hide the ‘Lazyest Gallery’ menu item from WordPress admin panel Dashboard for everyone but the administrators. This doesn’t hide the entire ‘Lazyest Gallery’ menu item, but it does remove the “edit Gallery” pages. The result is that your subscribers, contributors, authors, and editors will not be able to edit your gallery, nor delete your pictures. With the default settings on the plugin, your contributors have access to the edit the gallery, even delete pictures by accident. While it can be useful to give access to those user levels, you don’t always want to give that access.

This is useful if you don’t want registered users to be able to edit your gallery.

And now the code:

FILE TO MODIFY:

wp-content/plugins/lazyest-gallery/inc/admin.php

LINE TO MODIFY: LINE 105

THE CHANGE TO MAKE IS THIS:

One line 105, you’ll see an ‘add_menu_page’ functions. The third parameter of that functions is ‘read’. Change it from ‘read’ to ‘activate_plugins’. That’s all.

If you prefer to cut and paste instead, do this. Find the following code, which should be line 105:

$filemanager_page_hookname = add_menu_page( __('Lazyest Gallery'),
 __('Lazyest Gallery'), 'read', 'lazyest-filemanager',
 array( &$this , 'filemanager_page' ), 
path_join( $this->plugin_url, 'images/file-manager.png' ) );

and replace it with this new code:

$filemanager_page_hookname = add_menu_page( __('Lazyest Gallery'), 
__('Lazyest Gallery'), 'activate_plugins', 'lazyest-filemanager', 
array( &$this , 'filemanager_page' ), path_join( $this->plugin_url,
 'images/file-manager.png' ) );
NOTE: This code modifies the plugin core. If you do this, keep a change log of your changes. You’ll have to make these changes again after upgrading the Lazyest Gallery plugin to a new version. As always, modifications made to the plugin core will be overridden when you upgrade the plugin. The extra work is worth it to me, for a plugin that does what I want it to do. I keep a simple changelog, and re-doing the changes after an upgrade takes me about 2 minutes.

See more: , ,

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]