richtabor / MerlinWP

Better WordPress Theme Onboarding
https://merlinwp.com
GNU General Public License v3.0
692 stars 138 forks source link

Plugin is not activated during first setup #148

Open monparaashvin opened 5 years ago

monparaashvin commented 5 years ago

Hello Sir...@richtabor I'm testing this plugin with our theme and everything works perfect like charm.

The only issue I have face that, second plugin in list is not able to active. Here is the screenshot : screenshot

Here is the log : [2018-12-04 13:12:44] merlin-logger.DEBUG: A plugin with the following data will be processed {"plugin_slug":"elementor","message":"Activating"} [] [2018-12-04 13:12:44] merlin-logger.DEBUG: A plugin with the following data was processed {"plugin_slug":"elementor"} [] [2018-12-04 13:12:44] merlin-logger.DEBUG: A plugin with the following data will be processed {"plugin_slug":"meta-box","message":"Activating"} [] [2018-12-04 13:12:44] merlin-logger.DEBUG: A plugin with the following data will be processed {"plugin_slug":"meta-box","message":"Activating"} [] [2018-12-04 13:12:44] merlin-logger.DEBUG: A plugin with the following data will be processed {"plugin_slug":"redux-framework","message":"Activating"} [] [2018-12-04 13:12:47] merlin-logger.DEBUG: A plugin with the following data was processed {"plugin_slug":"redux-framework"} []

Looks like it tries to activate plugin two times.

Thank you.

SecondLineThemesHQ commented 5 years ago

We had the same issue. (With another plugin) Not sure what is causing it, but when including only the problematic plugin in TGMPA it did work fine.

richtabor commented 5 years ago

Hi @monparaashvin, do you mind posting a gist of the TMPGA plugins array that you're including? I'd like to run some tests with it.

monparaashvin commented 5 years ago

Here is array:-

$plugins = array(
        array(
            'name' => __('Elementor', 'txtdomain'),
            'slug' => 'elementor',
            'required'   => true,
        ),
        array(
            'name' => esc_html__( 'Meta Box', 'txtdomain' ),
            'slug' => 'meta-box',
            'required'   => true,
        ),
        array(
            'name' => esc_html__('MetaSlider', 'txtdomain'),
            'slug' => 'ml-slider',
        ),
        array(
            'name' => esc_html__('MailPoet 2', 'txtdomain'),
            'slug' => 'wysija-newsletters',
        ),

        array(
            'name'  => esc_html__( 'Contact Form 7', 'txtdomain' ),
            'slug'  => 'contact-form-7',
        ),
        array(
            'name' => esc_html__('Redux Framework', 'txtdomain'),
            'slug' => 'redux-framework',
            'required'   => true,
        ),
        array(
            'name' => esc_html__('WooCommerce', 'txtdomain'),
            'slug' => 'woocommerce',
        ),
        array(
            'name' => esc_html__('YITH WooCommerce Compare', 'txtdomain'),
            'slug' => 'yith-woocommerce-compare',
        ),
        array(
            'name' => esc_html__('YITH WooCommerce Wishlist', 'txtdomain'),
            'slug' => 'yith-woocommerce-wishlist',
        ),
    );
monparaashvin commented 5 years ago

Hi @richtabor Please test array the Merlin WP if you have time...

richtabor commented 5 years ago

Hi @monparaashvin, I ran some tests and here's what I found:

It looks like when Elementor is first, Meta Box does not want to install next. I'm not sure why.

So I next removed the requirement from Elementor, so I could move the plugin somewhere else in the list. That put Elementor right before MailPoet 2, which now did not want to install (again, after Elementor).

Findings: Anything after Elementor was not wanting to install.

SecondLineThemesHQ commented 5 years ago

Yup just found out about Elementor myself!

Looks like they have a splash screen right after the plugin's activation on a regular installation (no TGMPA / MerlinWP)

However, TGMPA does succeed when trying to install Elementor before a bunch of other plugins.

I'll look further into the splash screen and see if it's really the cause of the above issue, perhaps it could be removed with a filter.

-- EDIT -- @richtabor @monparaashvin Looks like the following code solves the issue:

function theme_prefix_remove_elementor_splash() { 
    delete_transient( 'elementor_activation_redirect' );
}
add_action( 'init', 'theme_prefix_remove_elementor_splash' );

By the way - Looks like MerlinWP is re-ordering the plugins from the array by alphabetical order. This means that even if you do place Elementor or any other problematic plugin last, it might still not be fixed. (Unless you use some code to fix the issue like suggested above)

Ninetheme commented 5 years ago

Hi @monparaashvin, I ran some tests and here's what I found:

It looks like when Elementor is first, Meta Box does not want to install next. I'm not sure why.

So I next removed the requirement from Elementor, so I could move the plugin somewhere else in the list. That put Elementor right before MailPoet 2, which now did not want to install (again, after Elementor).

Findings: Anything after Elementor was not wanting to install.

I think it is about after activationg theme action, may be need to disable elementor after activation actions

ghost commented 1 year ago

Here's an earlier hook to remove Elementor activation redirect:

function merlin_remove_elementor_welcome_redirect( $value, $expiration, $transient ) {
    delete_transient( 'elementor_activation_redirect' );
}

add_action( 'set_transient_elementor_activation_redirect', 'merlin_remove_elementor_welcome_redirect', 10, 3 );

It deletes the redirection transient right after it has been set.