• Resolved angeloarlotta

    (@angeloarlotta)


    Hi,
    I followed this useful guide to add a custom account tab:
    https://www.champ.ninja/2020/05/add-a-custom-account-tab-with-profile-form-fields/

    Unfortunately, when I deactivate the Ultimate Member plugin, the website crashes anytime and it will not be available anymore until I restore it.

    That’s because there isn’t a check in this code, if the plugin is active or not.

    Does anyone know how can I add a check?

    I tried with:
    if (is_plugin_active(‘ultimate-member/ultimate-member.php’)) {
    //code
    }

    The website seems not going down but the code to add the additional tab is not active.

    Anyone faced the same issue?

    Thanks,
    Angelo

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @angeloarlotta

    I’ve updated the code in the tutorial. Just add if( ! class_exists("UM") ) return; in the function __construct.

    It should look like this:

    function __construct( ){
             
             if( ! class_exists("UM") ) return;
             
    		add_filter( 'um_account_page_default_tabs_hook', array( $this, 'account_tabs' ), 999 );
    		add_action( 'template_redirect', array( UM()->form(), "form_init" ) );
    		
    }

    Regards,

    Thread Starter angeloarlotta

    (@angeloarlotta)

    thank you @champsupertramp it solved!??

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know. I’m marking this as resolved now.

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP check plugin state to avoid website crash’ is closed to new replies.