Viewing 3 replies - 1 through 3 (of 3 total)
  • The add_, update_ and get_ option functions are used for “configuration” values for plugins.

    The options for add_option are:

    add_option($name, $value, $description, $autoload);

    $name = name of the option
    $value = the value you want set
    $description = a description of this optioin
    $autoload = autoload this setting

    If autoload is set (default yes) then the setting is automatically retrieved by the get_alloptions function.

    You will want to add a page to either the ‘options’ or ‘manage’ section of the admin interface for your admin panel.

    For these you would use add_options_page or add_management_page respectively.

    Syntax:

    add_options_page(page_title, menu_title, access_level, file, [function]);

    or

    add_management_page(page_title, menu_title, access_level, file, [function]);

    e.g.

    add_options_page(‘Test Options’, ‘Test Options’, 8, __FILE__, ‘functiontocall’);

    (note: __FILE__ can be used to mean “this current plugin file” handles the display of options. The ‘functiontocall’ is called to display/save/set etc the options.)

    There is more good info, as usual, in the codex.. https://codex.www.ads-software.com/Adding_Administration_Menus

    Thread Starter snareklutz

    (@snareklutz)

    About Adding Administration Menus, does the code need to be run every single time the plugin runs, or just the first time?

    Thread Starter snareklutz

    (@snareklutz)

    Never mind, I’ve found out — you can run it every time and it’ll be fine. One question though, what does get_alloptions do?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Making Plugins – Database’ is closed to new replies.