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 know its possible to auto install/activate plugins (on theme activation) via something like http://tgmpluginactivation.com/

What I want to know is if its possible to activate plugins and auto-setup their unique preferences?

For example, its possible to auto install the All in One SEO Pack plugin using the code above.

Is it also possible to have the plugin settings changed from disabled (default) to enabled - so it actually starts working right out of the box?

share|improve this question
    
Could your plugin manage its own settings instead of using the Wordpress settings manager? You could just generate the things you need and keep them in the plugins tables or something like that? –  Simon Forster Sep 6 '12 at 10:15
add comment

1 Answer

I've answered a similar Question ( WP Multisite: Inherit plugin settings to new site ).

And, if understood correctly, "auto setup their unique preferences" would be a matter of adding/updating a custom plugin options array into wp_options table.

So, following the WP-Pagenavi example. After the plugin auto install/activate run something like:
(not tested)

function set_my_plugin_options(){
    $defaults = array(
        'pages_text'                    => 'Page %CURRENT_PAGE% of %TOTAL_PAGES%',
        'current_text'                  => '%PAGE_NUMBER%',
        'page_text'                     => '%PAGE_NUMBER%',
        'first_text'                    => '« First',
        'last_text'                     => 'Last »',
        'prev_text'                     => '«',
        'next_text'                     => '»',
        'dotleft_text'                  => '...',
        'dotright_text'                 => '...',
        'num_pages'                     => 5,
        'num_larger_page_numbers'       => 3,
        'larger_page_numbers_multiple'  => 10,
        'always_show'                   =>,
        'use_pagenavi_css'              => 1,
        'style'                         => 1
    );
    update_option( 'pagenavi_options', $defaults );
}
share|improve this answer
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.