Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm combining two of my plugins into one. I'd like to make the activation routine of the second plugin a checkbox selection in the settings panel of the new plugin.

However, I'm unsure how to execute functions when the options are submitted. How can I do this?

The my-plugin-options.php is basically this...

<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>
//options form goes here
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="check1, check2, check3, etc" />
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>

And its called from my main plugin file with this...

function my_settings_admin() {
include_once dirname(__FILE__) . '/my-plugin-options.php';
}

 add_options_page( 'My Plugin Settings', 
    'My Plugin Settings', 
    'manage_options', 
    'my-plugin-options.php', 
    'my_settings_admin', 
    $my_plugin_dir.'/favicon.png', 
    'top');
share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

If you are using the Settings API, then I'd say to add a check and function call for it in your sanitization callback (from register_setting).

share|improve this answer
    
I'm partially using it now. Checking out the tutorials at your link now. Thanks! –  Scott B Feb 5 '11 at 15:30
    
I was able to figure it out, between your link and this one > planetozh.com/blog/2009/05/… –  Scott B Feb 5 '11 at 18:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.