Support » Plugin: Tutor LMS - eLearning and online course solution » Missing the second param in add_action activated_plugin

  • Resolved vandung93

    (@vandung93)


    Hello @team,

    Your file tutor/classes/Tutor.php you used this hook/action

    
    add_action( 'activated_plugin', array( $this, 'activated_tutor' ) );
    
    public function activated_tutor( $plugin ) {
    	
    }
    

    Your code missing add the second param, It’s caused rasing PHP error if the third plugins also use this hook ‘activated_plugin’

    This is WordPress code do_action
    do_action( 'activated_plugin', $plugin, $network_wide );

    So you should be change your code to:

    
    add_action( 'activated_plugin', array( $this, 'activated_tutor' ), 10, 2 );
    
    public function activated_tutor( $plugin, $network_wide ) {
    	
    }
    
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter vandung93

    (@vandung93)

    Feature Request:

    Can you add filter to make themes can disable redirect to wizard page? Redirect code broken ‘TGM Plugin Activation’ plugin install other plugins after install Tutor plugin.

    Code like this:

    public function activated_tutor( $plugin ) {
    	if ( $plugin == tutor()->basename ) {
    		$do_setup = apply_filters( 'tutor_wizard_enable', get_option( 'tutor_wizard' ) );
    		
    		if ( ( ! $do_setup ) && version_compare( TUTOR_VERSION, '1.5.6', '>' ) ) {
    			update_option( 'tutor_wizard', 'active' );
    			exit( wp_redirect( admin_url( 'admin.php?page=tutor-setup' ) ) );
    		}
    	}
    }
    Plugin Support Shibbir Ahmed

    (@creativeartbd)

    Hello @vandung93

    Thank you very much again for this issue. I have passed this issue to our dev team.

    Kind Regards.

    Thread Starter vandung93

    (@vandung93)

    I can see you changed code in version 1.9.0. You added the second param in the function.

    But that is not completed fix:

    You have not add “Number Params” in hook:

    Please change from:

    add_action( 'activated_plugin', array( $this, 'activated_tutor' ) );

    to:
    add_action( 'activated_plugin', array( $this, 'activated_tutor' ), 10, 2 );

    Plugin Support Shibbir Ahmed

    (@creativeartbd)

    Thanks again. We are checking it.

    Thread Starter vandung93

    (@vandung93)

    Fixed in version 1.9.1

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.