Plugin Directory

Changeset 514852


Ignore:
Timestamp:
03/05/2012 06:38:20 PM (14 years ago)
Author:
Albert Bertilsson
Message:

Added link to settings from the plugin admin page.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • database-peek/trunk/settings.php

    r513959 r514852  
    1010            add_options_page('Database Peek', 'Database Peek', 'manage_options', 'ab-database-peek',
    1111                             array($this,'settings_page'));
     12                             
     13            add_filter('plugin_action_links', array($this, 'add_settings_link'), 10, 2 );
    1214        }
    1315
     16        function add_settings_link($links, $file) {
     17            static $this_plugin;
     18            if (!$this_plugin) $this_plugin = plugin_basename(__FILE__);
     19           
     20            $pos = strpos($file, '/');
     21            if (substr($file, 0, $pos) == substr($this_plugin, 0, $pos)) {
     22                $settings = __("Settings");
     23                $url = admin_url('options-general.php?page=ab-database-peek');
     24                $settings_link = "<a href=\"$url\">$settings</a>";
     25                array_unshift($links, $settings_link);
     26            }
     27           
     28            return $links;
     29        }
    1430
    1531        function register_mysettings() { // whitelist options
Note: See TracChangeset for help on using the changeset viewer.