Admin Menu Editor For WordPress

Here is my latest and hack-iest plugin yet – Admin Menu Editor. It’s a WordPress plugin that will let you manually edit the Dashboard menu. You can reorder the menus, show/hide specific items, change access rights, and more. The plugin is still a bit rough around the edges, so a good understading of WP internals is recommended (but not required).

Features

  • Sort menu items any way you want by simple drag & drop.
  • Move a menu item to a different submenu via cut & paste. Note that if you move an item that belongs to a plugin, you will need to modify the “File” attribute to point to the right parent file (e.g. instead of “akismet-key-config” use “options-general.php?page=akismet-key-config”).
  • Edit any existing menu – change the title, access rights, menu icon and so on. Note that you can’t lower the required access rights, but you can change them to be more restrictive.
  • Hide/show any menu or menu item. A hidden menu is invisible to all users, including administrators.
  • Create custom menus that point to any part of the Dashboard. For example, you could create a new menu leading directly to the “Pending comments” page.

Here’s a screenshot :

Admin Menu Editor screenshot

Download

menu-editor.zip (27 KB)

Requirements :

  • WordPress 2.7 or later
  • PHP 5 or later

Known Issues

The basic idea for the plugin was suggested by several commenters way back in October. However, the internal menu system that WordPress uses is obscure and unsuitable for direct manipulation, so I spent quite a while inventing workarounds. And even after a few weeks of pondering, there are some things I haven’t quite fixed.

  • If you delete any of the default menus they will reappear after saving. This is not a bug, it’s a feature ;)
  • You can’t use arbitrary URLs as menu targets because WordPress will automatically strip off the “http:/”.
  • As I mentioned before, the access rights required for using a particular menu item can’t be lowered, but can be made more strict. I think.
  • Also, a plugin’s menu that is moved to a different submenu will not work unless you also include the parent file in the “File” field. This is because WP “ties” the menu item to it’s parent menu and won’t recognize it in a different submenu.

Merry Christmas, by the way :)

Share :
  • Reddit
  • del.icio.us
  • Digg
  • StumbleUpon
  • DZone
  • Ping.fm
  • Sphinn
Related posts :

139 Responses to “Admin Menu Editor For WordPress”

Pages: « 1 2 [3] 4 5 » Show All

  1. 50
    White Shadow says:

    You can already change the icons for top-level menus (i.e. the “Icon URL” field), though you’d have to manually upload the right icons to wp-admin/images/ for that to work. Changing colors would require a custom stylesheet. Hmm.

    Eh, so that’s another item on my huge idea list. The suggestions wouldn’t be too hard to implement, but there’s so much other stuff I could/should work on that I can’t say when/if I’ll get to updating plugin.

  2. 51
    Jonny says:

    Hi there

    Great work on the plugin!!! but after upgrading to WP 2.7.1 it’s stopped working!! I’m now getting a blank screen when I try to activate the plugin, with the error

    “PHP Fatal error: Cannot use object of type stdClass as array in /****/*******/public_html/wp-content/plugins/menu-editor/menu-editor.php on line 395″

    I noticed in the comments that you’ve released version 0.1.2 which fixes this, but the download link still seems to be for 0.1.1?!?

    Any help would be greatly appreciated!!

  3. 52
    White Shadow says:

    Hmm, I see. Apparently this problem is caused by a conflict with Simple Tags. It has the same bug as this plugin had prior to 0.1.2 and it happens to define the buggy function before Admin Menu Editor can create the correct one. I’ve uploaded a new version (0.1.3) that should fix this issue.

  4. 53
    Jonny says:

    White Shadow

    Thanks for getting back so quickly. I disabled all my other plugins and installed the new 0.1.3 version but still getting the blank screen once it’s activated!!!

  5. 54
    White Shadow says:

    Try this : manually delete this plugin and reinstall it anew. Maybe there’s an old file somewhere that creates problems.

  6. 55
    Jonny says:

    Nope still no luck unfortunately

  7. 56
    White Shadow says:

    Well, are you still getting the same error message (which should be impossible as there is no line 395 in that file anymore)?

  8. 57
    Jonny says:

    The error is now on line 380 as follows:

    Cannot use object of type stdClass as array in /****/*******/public_html/wp-content/plugins/menu-editor/menu-editor-core.php on line 380

  9. 58
    White Shadow says:

    I’m out of ideas for the time being.

  10. 59
    Michelle says:

    Hi,

    I’ve just installed WP 2.7.1 and don’t have any other plugins installed yet. When I try to activate Admin Menu Editor v 0.1.3 I get this “fatal error”:

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /homepages/18/d90242274/htdocs/themetest/wp-content/plugins/menu-editor/menu-editor-core.php on line 13

    Any ideas? thank you so much! :-)

    Michelle

  11. 60
    White Shadow says:

    You probably have an old version of PHP. You will need at least PHP 5 to use this plugin.

  12. 61
    Michelle says:

    I’m using PHP 5, hosted on 1and1.

    I am running two different WP sites in this database, however, using different – what’s the opposite of extension? pretension? lol – different pre-something-or-others for the table names: wp_tt_ and wp_zz_. Would that make any difference?

    Thanks again for your help!

    Michelle

  13. 62
    White Shadow says:

    It’s called the “prefix”, and that shouldn’t make a difference.

    The error is on a line that declares a protected class variable. Protected variables were introduced in PHP 5. If they don’t work I can only conclude that you don’t in fact have PHP 5 :P

  14. 63
    Michelle says:

    I bow to you; I am an idiot. Whatever brand of dyslexia I have had me reading “PHP 5″ and thinking “MySQL 5″. I have upgraded to PHP 5 and all now works perfectly.

    Apologies for the stupid user error and thank you a hundred times for your patience. And for coming up with the word “prefix”. Sheesh. I am so glad yesterday is over. :)

  15. 65
    Erick says:

    I like your plugin. It installed and functions perfectly except for the moving links issue. Someone mentioned it on the wordpress.org/support page.

    side note: Is it possible to be able to select the dashboard modules specifically for a user level? It seems that what ever is seen on my dashboard is also seen on all users.

  16. 66
    White Shadow says:

    User levels are obsolete and wouldn’t work this way, but you could use user capabilities. For example, if you put “edit_plugins” in the “Access level” field for a menu item, only user with that capability will be able to see/access that menu.

  17. 67
    mike says:

    I am having some trouble with the user permissions. The plugin is letting me block access for certain parts of the admin but not others.

    I am simply adding edit_plugins to the access field of any area that I dont want the user to be able to access. For some reason it is not working for tools and users and possibly others.

  18. 68
    Mike says:

    NVM, I just realized I need to block the sub menus also.

    Now I just have to figure out how to have only EITHER the “users” or the “profile” menu visible. I dont want both to be visible to the user. The problem is the “profile” menu is not in the list of main menu items.

    Thanks for the help and a great plugin. I hope to use it to make a custom admin page eventually.

  19. 69
    Mike says:

    alright I think I have the fix to removing the users menu without interrupting the profile menu. I just removed the profile.php from the profile submenu, and created a new custom main menu and added the profile.php file to that.

    For some reason the profile.php file returned to the original profile menu and the access feild went back to read, but it does appear to be working.

    Thanks again for a great plugin, this looks like it could take the place of the roles plugin when that becomes obsolete.

  20. 70
    White Shadow says:

    I’m glad to hear you got it working.

    Regarding the “Users” and “Profile” menus, WordPress automatically adds or reconfigures them depending on the logged-in user. This is a special case that isn’t handled by the plugin, so you could end up with both menus at the same time when using it.

    I could probably fix it with some inelegant hack, but I’m lazy :)

  21. 71
    Mike says:

    Ya it is a bit hacky as your description says. You can get the users menu to disappear if you change the file and access for my profile under the users menu.

    The hacky part is that when you make another change the change you made to the my profile goes back to normal. So whenever you make a change you have to remember to go back and change the my profile.

    I am also having a similar issue with an email plugin that I want to restrict certain areas. All in all I cant complain tho. As long as it gets the job done that is all that counts.

    With this plugin I was able to hide a few menus and make my admin much less intimidating to users.

    Now I just have to figure out how to make a solid custom menu, which hopefully wont give me any trouble.

  22. 72
    Ross says:

    Hi, i get this error when trying to activate your plugin.

    Fatal error: Class ‘ReflectionClass’ not found in /home/wp/public_html/wordpress/wp-content/plugins/menu-editor/shadow_plugin_framework.php on line 101

    Im using WP 2.7.1 and I have PHP 5.2+, i have tried deactivating all my other plugins.
    Any idea what could be wrong?

  23. 73
    White Shadow says:

    The PHP documentation claims that the reflection API is included in PHP 5 by default, so either it’s been somehow turned off in your PHP configuration (I don’t know if that’s even possible), or you’re not really using PHP 5. Those arep retty much the only causes I can think of.

  24. 74
    Mike says:

    Would you be willing to write up a quick tutorial on how to use your plugin to create a top level menu page?

    I gave it a shot but couldn’t make it happen.

    thanks, MIke

  25. 75
    White Shadow says:

    What exactly is the problem? I just use the “New” button to add a custom top menu, save, add a few menu items to the new menu, and it seems to work.

  26. 76
    Mike says:

    I am looking to add a new php file to the menu. It just needs to have a link with a popout so the php file will be pretty simple. I just cant figure out what exactly needs to be in the php file.

    I have been trying to get my head around this http://codex.wordpress.org/Adding_Administration_Menus

    I have tried a few things but cant seem to get it to work.

    Maybe your plugin is not intended to work in this way…

  27. 77
    White Shadow says:

    I’m still not quite sure what you’re trying to accomplish. Do you want the menu/submenu to point to an URL outside the Dashboard? That would be impossible without writing some kind of custom redirector script or hacking the WP core, as the script that outputs menus would always mangle the external link otherwise. However, a relative URL like “/stuff/foo/bar.php” might work.

    Or maybe I’ve misunderstood your comment and what you actually want is to write a new plugin.

  28. 78
    Mike says:

    I am just trying to add a basic menu, when the user clicks on the menu item, it will bring them to the menu page that I have created. Inside that menu page will be a link, maybe that is where you were confused. I am not trying to redirect the menu to an outside page.

    I tried writing a basic plugin to handle this, but was unsuccessful. I guess I am not sure what needs to be included, the only part I do know is what will be echoed onto the page(some text with a simple popout link)

  29. 79
    White Shadow says:

    Allright, how about this super-simple plugin :

    <?php
    /*
    Plugin Name: Example Plugin
    Plugin URI: http://w-shadow.com/
    Description: Adds a menu item. That's it. 
    Version: 1.0
    Author: Janis Elsts
    Author URI: http://w-shadow.com/
    */
     
    /*
    Created by Janis Elsts (email : whiteshadow@w-shadow.com) 
    It's LGPL.
    */
     
    //Are we running in the Dashboard?
    if ( is_admin() ) {
     
        class MyMiniPlugin {
     
    		function __construct(){
    			add_action('admin_menu', array(&$this, 'hook_admin_menu'));
    		}
     
    		function hook_admin_menu(){
    			//Add a top-level menu.
    			//Note : This menu will also be automatically added as the first
    			//submenu of itself. Might be a bit confusing ;) 			
    			add_menu_page('Example Menu', 'Example Menu', 'manage_options', 
    				'example_top_menu', array(&$this, 'page_example_top_menu'));
    			//Add a submenu. Might be optional in your case. 
    			add_submenu_page('example_top_menu', 'Example Submenu', 'Example Submenu',
    				'manage_options', 'example_submenu', array(&$this, 'page_example_submenu'));
    		}
     
    		//This function outputs the HTML for "Example Menu"
    		function page_example_top_menu(){
    			echo "Top menu page";
    		}
     
    		//This function outputs the HTML for "Example Submenu"
    		function page_example_submenu(){
    			echo "Submenu page";
    		}
     
    	};
     
    	$myplugin = new MyMiniPlugin;
     
    }//is_admin()
    ?>

    It adds a top-level menu and then adds a submenu entry to that new menu. Requires PHP 5 (because I’m lazy) and should work in at least WP 2.5 and up.

Pages: « 1 2 [3] 4 5 » Show All

Leave a Reply