Quick Configuration Links For All Plugins : A WordPress Hack

Some time ago Jeff @ weblogtoolscollection.com wrotea post or, shall we say, a rant about how one can waste a lot of time searching for a plugin’s configuration page because it’s tucked away in some remote menu and/or unintuitively named.

The proposed solution was to have all plugins add a “Settings” link to their listing on the Plugins page, which is overall a good idea that I’ve already implemented in some of my plugins. Also, some recent developments in the WP core seem promising and will make it easier for plugin authors to implement this feature. But what about plugins that don’t (or won’t) support this? What about old and/or unmaintained plugins?

When In Doubt, …

So I made a quick hack. It’s a plugin that will scan the WordPress menu structure and attempt to locate the configuration page for each of the active plugins, and add a “Settings” link to the plugin’s row – right besides the “Deactivate” and “Edit” links. The plugin is also smart enough to skip this for plugins that have already added the configuration link on their own (in most cases).

As for the success rate, the plugin correctly added the “Settings” link to 12 of my plugins, and failed to do so for 9 plugins. That’s not too bad. I have a few ideas about how to improve the results considerably, if anyone cares.

Update : It should work with 99% of plugins, provided you’re running PHP 5 or above. I used the PHP introspection tools to match menu items and plugin files, as suggested by Andrew in a comment below. If your server runs PHP 4 the results will vary widely based on what plugins you have installed.

Download

quick-configuration-links.zip (3 KB)
Install it like any other plugin – upload & activate. I’ve tested the plugin with WP 2.6.2 and 2.7 (beta); it will probably work fine in 2.5, too.

On an unrelated note, is it a Feedburner glitch (again), or did I really lose 150 RSS subscribers in just a few days?

Related posts :

16 Responses to “Quick Configuration Links For All Plugins : A WordPress Hack”

  1. Andrew says:

    That’s a really good idea, I like it. I started thinking about ways of making it clearer and perhaps iterating through the menu arrays and using reflection to identify the documents where the callbacks are held and then scan those documents for the plugin information.

    Sounds like a lot of work thought, there is probably a much easier solution.

  2. White Shadow says:

    One could also scan through the plugin files and look for calls to “add_options_menu” and other similar functions, but there might be problems with parsing variables etc.

    I’m kind of ashamed to say I hadn’t heard of reflection before, I’ll look into it and see how/if it can be applied here.

  3. Andrew says:

    That might indeed be far easier. I have personally never used reflection although I understand the idea. It also occurs that the add_options_menu probably has a hook assigned to it. Using that to trigger the addition would seem to tick all the boxes.

  4. White Shadow says:

    Unfortunately, add_options_menu, or rather the actual function doing the work – add_submenu_page – doesn’t run any hooks (I’ve checked). I’m digging through the core at the moment…

  5. White Shadow says:

    It is done! Turns out reflection was the easiest part, the real trouble was deciphering WordPress’ internal structures and their interactions. Now the plugin should work with nearly 100% of plugins.

  6. Jeffro2pt0 says:

    This sounds like a really cool idea. Going to give this a shot on my local WordPress install which has a host of plugins and I’ll probably write this up in a future post. Thanks for the link and this contribution to the community.

  7. […] everyday users though there is another option. White Shadow has written a plugin that will find plugins that are adding config menus to the WordPress admin and add a configure link […]

  8. Jeffro2pt0 says:

    So I’ve checked out the plugin on my local install and I’m happy to report that most of the plugins now have a settings link in the plugin management panel. However, now all of the plugins have the link. This is probably due to the age of the plugin and the way it was coded.

    Do you want a list of plugins I discovered that don’t have the settings link?

    Other than that, the only issue I see now is that I have to use my browsers back button to go back to the plugin panel instead of clicking on a link to go back or, after clicking a save button to save the settings, have it redirect me back to the plugin panel.

  9. White Shadow says:

    Thanks for checking it out 🙂

    Yes, it might be helpful to know which plugins don’t have the link. I had several plugins missing the links, but I’ve fixed that for all the plugins I have installed.

    I don’t think I can – or should – alter the behaviour of the settings page itself without inventing some kind of JS hack, unless there’s an API that I don’t know about (possible).

  10. Kim says:

    I’ve just installed your plugin, and, so far, all of the plugins that have a settings page have the link added. However, there are 2 plugins where the link provided isn’t accurate:

    Akismet – the link goes to the new Akismet Stats page rather than the configuration page.

    Wassup – brings up a 404 page. (http://www.wpwp.org/)

    I also see in the latest post on the Weblog Tools Collection blog where this functionality is going to be included in the core. I think that’s great! 🙂

  11. Kim says:

    I’ve discovered an issue that needs addressing. When logged in as a subscriber, I am getting the following warning at the top of the Profile page:

    Warning: Invalid argument supplied for foreach() in /home/xxxxxx/public_html/xxxxxx/wp-content/plugins/plugin-settings-links/plugin_settings_links.php on line 96

    Lines 94-96 are:

    //Check all menus for plugin pages
    foreach ($items as $topmenu => $item){
    foreach ($item as $subitem){

    I do not get that warning when logged in at the admin level.

    Any ideas on a fix?

  12. White Shadow says:

    Arrgh, turns out the WP menu system is way more twisted than I though. Everything you reported should be fixed now. Re-download the new version from the same link.

    As far as I know the core functionality won’t be exactly like this – it will just make it easier for plugin authors to add the links, it won’t automatically show them for all older plugins (or at least that’s how I understand it).

  13. Another priceless plugin. I was so frustrated at WP for not doing this by default – it makes so much sense. Stumbled and delicioused.

  14. Loan Modification says:

    Loan Modification…

  15. […] Quick Configuration Links by Janis Elsts With a lot of plugins installed, it becomes increasingly hard to hunt down that one […]

  16. […] – Quick Configuration Links For Plugins – It’s a plugin that will scan the WordPress menu structure and attempt to locate the […]

Leave a Reply