WordPress settings for custom plugin

Ottopress has a pretty good tutorial for writing a wordpress plugin settings page but its a little confusing if you dont see the software flow

Here is my interpretation




* Created by Urbanpixels.com
* Author: Chuck
* Copyright: 8/12]0/12 All Rights Reserved
add_action('admin_menu', 'kpi_forum_admin_add_page');
$settings_slug = 'kpi-forum-settings'; // array catcher
$plugin_slug = 'kpi-forum';
$section_slug = 'kpi-forum-section';
add_action('admin_init', 'kpi_forum_admin_init');
function kpi_forum_admin_init(){
global $plugin_slug,$settings_slug,$section_slug;
register_setting( $settings_slug, $settings_slug, 'kpi_forum_validate' );
add_settings_section($section_slug, 'KPI Forum Settings', 'kpi_forum_section_description', $plugin_slug);
add_settings_field('kpi-forum-test-field', 'Test', 'kpi_forum_test_field', $plugin_slug, $section_slug);
add_settings_field('kpi-forum-foo-field', 'Foo', 'kpi_forum_foo_field', $plugin_slug, $section_slug);

function kpi_forum_admin_add_page() {
global $plugin_slug;
add_options_page('Custom Plugin Page', 'KPI Forum', 'manage_options', $plugin_slug, 'kpi_forum_form');
function kpi_forum_form() {
global $plugin_slug,$settings_slug;
<h2>KPI Forum Settings</h2>
<form method="post" action="options.php">
settings_fields( $settings_slug );
do_settings_sections( $plugin_slug );


function kpi_forum_section_description() {
Some text describe section one

function kpi_forum_test_field() {
global $settings_slug;
$options = get_option($settings_slug);
<input type="text" name="kpi-forum-settings[test]" value="<?php echo $options['test'];?>"/>
function kpi_forum_foo_field() {
global $settings_slug;
$options = get_option($settings_slug);
<input type="text" name="kpi-forum-settings[foo]" value="<?php echo $options['foo'];?>"/>
function kpi_forum_validate($options) {
return $options;

Firefox plugins and XUL

Writing XUL is a giant pain in the ass and the documentation is lacking any examples.
Here is a good resource


Excerpt from that page

There is a list of some resources here
https://addons.mozilla.org/en-US/develo … ng-started

This tutorial is quite a helpful introduction
https://developer.mozilla.org/En/Firefo … Extensions

I generally just use MDC (Mozilla Developer Center) for reference (just keep an eye on what version of Firefox/Gecko the documentation applies to)

The XUL periodic table is a helpful resource for basic XUL element layout

W3Schools is a useful basic reference for DOM and Javascript

There is a list of the Mozilla interfaces here

The DOM inspector is a “must have”

Anyway that’s just a few that you might find useful