Auto activate plugin with unique user settings

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?

Read More

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?

Related posts

Leave a Reply

1 comment

  1. I’ve answered a similar Question ( Inherit plugin settings to new site in Multisite ).

    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 );
    }