Skip to Content
Menu

register_required_plugins()

Registers required and recommended plugins that work best with Nebula.

PHP April 27, 2017

Usage

This function runs automatically, so it is not called manually. Is this incorrect?

Additional Notes

This method allows for always up-to-date plugins to be bundled with Nebula. This requires the TGM Plugin Activation library.

Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /libs/Admin/Automation.php on line 51.

    1 Hook

    Find these filters and actions in the source code below to hook into them. Use do_action() and add_filter() in your functions file or plugin.

    Filters
    "nebula_bundled_plugins"
    Need a new filter hook? Request one here.

    Actions
    This function has no action hooks available. Request one?

    PHP
            public function register_required_plugins(){
                global $pagenow;
    
                //If this user is on the Plugins or Themes (Appearance) admin pages or has not yet dismissed the TGMPA admin notice
                if ( $pagenow === 'plugins.php' || $pagenow === 'themes.php' || !get_user_meta(get_current_user_id(), 'tgmpa_dismissed_notice_nebula') ){
                    $this->timer('Register Bundled Plugins');
    
                    $bundled_plugins = array(
                        array(
                            'name' => 'Contact Form 7',
                            'slug' => 'contact-form-7',
                            'required' => true,
                        ),
                        array(
                            'name' => 'Honeypot for Contact Form 7',
                            'slug' => 'contact-form-7-honeypot',
                            'required' => true,
                        ),
                        array(
                            'name' => 'Contact Form 7 Database Addon – CFDB7', //Backup CF7 DB plugin until (if) the preferred plugin (advanced-cf7-db) is updated
                            'slug' => 'contact-form-cfdb7',
                            'required' => true
                        ),
                        array(
                            'name' => 'Advanced Custom Fields',
                            'slug' => 'advanced-custom-fields',
                            'required' => false,
                        ),
                        array(
                            'name' => 'EWWW Image Optimizer',
                            'slug' => 'ewww-image-optimizer',
                            'required' => false,
                        ),
                        array(
                            'name' => 'Regenerate Thumbnails',
                            'slug' => 'regenerate-thumbnails',
                            'required' => false,
                        ),
                        array(
                            'name' => 'WP-PageNavi',
                            'slug' => 'wp-pagenavi',
                            'required' => true,
                        ),
                        array(
                            'name' => 'Multiple Themes',
                            'slug' => 'jonradio-multiple-themes',
                            'required' => false,
                        ),
                        array(
                            'name' => 'Responsive Lightbox',
                            'slug' => 'responsive-lightbox',
                            'required' => false,
                        ),
                        array(
                            'name' => 'WP Mail SMTP',
                            'slug' => 'wp-mail-smtp',
                            'required' => false,
                        ),
                        array(
                            'name' => 'WooCommerce',
                            'slug' => 'woocommerce',
                            'required' => false,
                        ),
                        array(
                            'name' => 'WordPress SEO by Yoast',
                            'slug' => 'wordpress-seo',
                            'required' => true,
                        ),
                        array(
                            'name' => 'ACF Content Analysis for Yoast SEO',
                            'slug' => 'acf-content-analysis-for-yoast-seo',
                            'required' => false,
                        ),
                        array(
                            'name' => 'Relevanssi',
                            'slug' => 'relevanssi',
                            'required' => true,
                        ),
                        array(
                            'name' => 'Transients Manager',
                            'slug' => 'transients-manager',
                            'required' => false,
                        ),
                        array(
                            'name' => 'UpdraftPlus Backup and Restoration',
                            'slug' => 'updraftplus',
                            'required' => false,
                        ),
                        array(
                            'name' => 'Wordfence Security', //Used for general security and limiting login attempts
                            'slug' => 'wordfence',
                            'required' => false,
                        ),
                        array(
                            'name' => 'Sucuri Security', //Used to monitor filesystem and log login attempts, other hardening tools
                            'slug' => 'sucuri-scanner',
                            'required' => false,
                        ),
                        array(
                            'name' => 'Query Monitor',
                            'slug' => 'query-monitor',
                            'required' => false,
                        ),
                        array(
                            'name' => 'All-in-One WP Migration',
                            'slug' => 'all-in-one-wp-migration',
                            'required' => false,
                        ),
                        array(
                            'name' => 'Redirection',
                            'slug' => 'redirection',
                            'required' => false,
                        ),
                        array(
                            'name' => 'Site Kit by Google',
                            'slug' => 'google-site-kit',
                            'required' => false,
                        ),
                    );
    
                    if ( is_plugin_active('woocommerce/woocommerce.php') ){
                        $bundled_plugins[] = array(
                            'name' => 'WooCommerce Google Analytics Integration',
                            'slug' => 'woocommerce-google-analytics-integration',
                            'required' => true,
                        );
                    }
    
                    $all_bundled_plugins = apply_filters('nebula_bundled_plugins', $bundled_plugins); //Allow other themes and plugins to bundle additional plugins
    
                    $config = array(
                        'id' => 'nebula',
                        'parent_slug' => 'plugins.php', //Where the "Install Plugins" submenu appears. Note: WordPress.org theme distribution requires this to be under "themes.php"
                        'strings' => array(
                            'menu_title' => 'Recommended Plugins',
                            'page_title' => 'Recommended Plugins',
                            'notice_can_install_required' => _n_noop(
                                'This theme recommends the following plugin: %1$s.',
                                'This theme recommends the following plugins: %1$s.',
                                'tgmpa'
                            ),
                            'notice_can_install_recommended' => _n_noop(
                                'The following optional plugin may be needed for the theme: %1$s.',
                                'The following optional plugins may be needed for the theme: %1$s.',
                                'tgmpa'
                            ),
                            'notice_can_activate_required' => _n_noop(
                                'The following recommended plugin is currently inactive: %1$s.',
                                'The following recommended plugins are currently inactive: %1$s.',
                                'tgmpa'
                            ),
                            'notice_can_activate_recommended' => _n_noop(
                                'The following optional plugin is currently inactive: %1$s.',
                                'The following optional plugins are currently inactive: %1$s.',
                                'tgmpa'
                            ),
                        )
                    );
    
                    tgmpa($all_bundled_plugins, $config);
                    $this->timer('Register Bundled Plugins', 'end');
                }
            }
    

    Override

    This function can not be short-circuited with an override filter. Request one?